Git的起源在脑后

时间:2019-01-28 10:36:43

标签: git

我在我的点文件的git repo上有两个分支,分别是masterkimura,并且在GitLab上进行了远程设置。如果我结帐了一个分支和git push,就会被告知我是最新的...

$ git checkout master
Already on 'master'
$ git push
Everything up-to-date
$ git checkout kimura
Switched to branch 'kimura'
$ git push
Everything up-to-date

我已经在分支kimura上进行了更改,并提交并合并了对主服务器的请求,然后使用...将kimura与主服务器合并了。

$ git checkout kimura
Switched to branch 'kimura'
$ git merge origin/master
Already up to date.

但是,我有电力线提示(在ZSH下),并且都显示我已经提交等待等待提交,并且当我查看历史记录时,它显示两个分支的origin都位于{{1}之后} ...

HEAD

我不确定如何将任一分支上的* ef61530 - (HEAD -> kimura) Resolving conflict to merge master into kimura (2019-01-26) <slackline> |\ | * 1ece19c - (origin/master) Reinstated sourcing of virtualenvwrapper.sh on work host (2019-01-18) <slackline> | * 80efc48 - Merge branch 'kimura' into 'master' (2018-12-17) <nshephard> | |\ * | | f32a089 - tweaking virtualenvwrapper.sh path for new host (2019-01-24) <slackline> * | | d2ccb42 - Tweaking specifics for work machine. (2019-01-24) <slackline> * | | 13fc696 - Updates to a few files (2019-01-24) <slackline> * | | a453190 - Added gnupg to link section (2019-01-23) <slackline> * | | c7da4ac - Added todo task and display of warnings at end of setup (2019-01-23) <slackline> * | | 07f313b - Added gnupg (2019-01-23) <slackline> * | | 20cf7f8 - Copying sample code from James (2019-01-23) <slackline> * | | 4edf7b5 - updated path for /mnt/personal (2019-01-12) <slackline> * | | 0b61635 - adding work_laptop profile (2018-12-19) <slackline> * | | 71c7d3f - Adding config/.config/.pycodestyle (2018-12-18) <slackline> | |/ |/| * | 8ac383a - (origin/kimura) Starting off yapf config (2018-12-17) <slackline> |/ * 3d6aac6 - Merge branch 'master' of gitlab.com:nshephard/dotfiles into kimura (2018-12-10) <slackline> origin对齐,并且会感谢任何建议/指针。

编辑:

在@Tim Biegeleisen的建议下,我尝试了以下方法...

HEAD

然后我尝试将$ git fetch origin From gitlab.com:nshephard/dotfiles * branch master -> FETCH_HEAD $ git checkout kimura Switched to branch 'kimura' $ git merge origin/master Already up to date. 分支直接与kimura合并...

master

将'kimura'分支为'master'

$ git checkout origin/master                                                                                                                                                                                                                                                                           
error: Your local changes to the following files would be overwritten by checkout:                                                                                                                                                                                                                                              
    gnupg/.gnupg/random_seed                                                                                                                                                                                                                                                                                                
Please commit your changes or stash them before you switch branches.                                                                                                                                                                                                                                                            
Aborting                                                                                                                                                                                                                                                                                                                        
$ git stash                                                                                                                                                                                                                                                                                            
Saved working directory and index state WIP on kimura: 8464bcc Merge 

...并且在分支$ git checkout origin/master Note: checking out 'origin/master'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new-branch-name> HEAD is now at 1ece19c Reinstated sourcing of virtualenvwrapper.sh on work host 上,起源仍然不是master的最新版本,因为我现在处于分离状态,回到了HEAD尚未合并的提交...

origin

...并再次为如何合并所有内容并使* 1ece19c - (HEAD, origin/master) Reinstated sourcing of virtualenvwrapper.sh on work host (Fri Jan 18 10:52:17 2019 +0000) <Neil Shephard> * 80efc48 - Merge branch 'kimura' into 'master' (Mon Dec 17 18:10:50 2018 +0000) <nshephard> |\ | * 8ac383a - (origin/kimura) Starting off yapf config (Mon Dec 17 17:15:42 2018 +0000) <slackline> |/ * 3d6aac6 - Merge branch 'master' of gitlab.com:nshephard/dotfiles into kimura (Mon Dec 10 10:41:47 2018 +0000) <slackline> |\ | * 2e0a40e - Resolving conflicts in zsh/.zshrc (Mon Dec 10 10:35:45 2018 +0000) <Neil Shephard> | |\ | | * 1b0a018 - Merge branch 'kimura' into 'master' (Thu Dec 6 10:22:25 2018 +0000) <nshephard> | | |\ | * | | a6f3350 - Removing line that calls virtualenvwrapper on work computer (Mon Dec 10 10:32:47 2018 +0000) <Neil Shephard> | |/ / | * | fefb0b0 - Commenting out $PATH (Mon Dec 3 13:38:33 2018 +0000) <Neil Shephard> | * | 2597385 - Merge branch 'kimura' into 'master' (Wed Nov 14 09:57:56 2018 +0000) <nshephard> | |\ \ * | | | 69d1599 - Added port forwarding for mongodb to ds1 config (Fri Dec 7 10:33:52 2018 +0000) <slackline> | |_|/ |/| | origin内联而感到困惑。

编辑2:

按照@torek的要求...

HEAD

我的git配置看起来像...

$ git rev-parse --abbrev-ref master@{upstream}
fatal: upstream branch 'refs/heads/master' not stored as a remote-tracking branch

当前日志/图形看起来像...

user.email=xxxxx@gmail.com
user.name=slackline
push.default=simple
credential.helper=cache
pack.window=0
pack.windowmemory=100m
pack.packsizelimit=100m
pack.threads=1
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@gitlab.com:nshephard/dotfiles.git
remote.origin.pushurl=git@gitlab.com:nshephard/dotfiles.git
remote.origin.push=+refs/heads/*:refs/heads/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.master.pushremote=origin
submodule.tmux/.tmux/plugins/tpm.url=https://github.com/tmux-plugins/tpm
submodule.tmux/.tmux/plugins/tpm.active=true
submodule.oh-my-zsh/.oh-my-zsh.url=https://github.com/robbyrussell/oh-my-zsh
submodule.oh-my-zsh/.oh-my-zsh.active=true
submodule.emacs/emacs.url=git@gitlab.com:nshephard/emacs.git
submodule.emacs/emacs.active=true
submodule.emacs/.emacs.d.url=git@gitlab.com:nshephard/emacs.git
submodule.emacs/.emacs.d.active=true
submodule.fonts.url=https://github.com/powerline/fonts
submodule.fonts.active=true
branch.kimura.remote=origin
branch.kimura.merge=refs/heads/kimura
branch.kimura.fetch=+refs/heads/*:refs/heads/*

1 个答案:

答案 0 :(得分:4)

我从未见过您在做git fetchgit pull,因此您的本地分支很可能与远程服务器不同步。以下应该起作用:

git fetch origin
git checkout kimura
git merge origin/master

git fetch调用应使用来自远程服务器的最新更改来更新本地跟踪分支origin/master。假设您已拉出该分支,也可以直接与master合并:

git checkout master
git pull origin master
git checkout kimura
git merge master