- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我在我的点文件的 git 存储库上有两个分支,master
和 kimura
以及 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
进行了更改,并提交并 merge 了 pull-requests 到 master,然后使用...将 kimura
与 master merge
$ git checkout kimura
Switched to branch 'kimura'
$ git merge origin/master
Already up to date.
但是我有电力线提示(在 ZSH 下)并且都显示我已经提交等待被推送并且当我查看历史时它显示两个分支的 origin
都在 头
...
* 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
与 HEAD
保持一致,如果有任何建议/指点,我将不胜感激。
编辑:
根据@Tim Biegeleisen 的建议,我尝试了以下...
$ 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
merge ...
$ 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
将'kimura'分支为'master'
$ 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
origin 仍然不是最新的 HEAD
因为我现在处于分离状态已经回到origin
并且有尚未 merge 的提交...
* 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>
| |_|/
|/| |
...关于如何 merge 所有内容并使 origin
与 HEAD
内联,我再次感到困惑。
编辑 2:
根据@torek 的要求...
$ git rev-parse --abbrev-ref master@{upstream}
fatal: upstream branch 'refs/heads/master' not stored as a remote-tracking branch
我的 git 配置看起来像...
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/*
当前日志/图表看起来像...
* 564630f - (HEAD -> kimura, master) Merge branch 'kimura' into 'master' (Mon Jan 28 16:01:30 2019 +0000) <nshephard>
|\
| * c6c75ba - Updating to use RSA keys as seahorse doesn't like ed25519 keys (Mon Jan 28 16:00:35 2019 +0000) <slackline>
|/
* 8464bcc - Merge branch 'kimura' into 'master' (Sat Jan 26 09:32:05 2019 +0000) <nshephard>
|\
| * ef61530 - Resolving conflict to merge master into kimura (Sat Jan 26 09:30:54 2019 +0000) <slackline>
| |\
| | * 1ece19c - (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>
| | |\
* | | \ 6138abc - Merge branch 'kimura' into 'master' (Thu Jan 24 11:39:35 2019 +0000) <nshephard>
|\ \ \ \
| |/ / /
| * | | f32a089 - tweaking virtualenvwrapper.sh path for new host (Thu Jan 24 11:39:04 2019 +0000) <slackline>
| * | | d2ccb42 - Tweaking specifics for work machine. (Thu Jan 24 11:37:48 2019 +0000) <slackline>
| * | | 13fc696 - Updates to a few files (Thu Jan 24 07:09:41 2019 +0000) <slackline>
| * | | a453190 - Added gnupg to link section (Wed Jan 23 13:08:29 2019 +0000) <slackline>
| * | | c7da4ac - Added todo task and display of warnings at end of setup (Wed Jan 23 11:01:08 2019 +0000) <slackline>
| * | | 07f313b - Added gnupg (Wed Jan 23 10:58:22 2019 +0000) <slackline>
| * | | 20cf7f8 - Copying sample code from James Ridgway https://github.com/jamesridgway/dotfiles/blob/master/setup (Wed Jan 23 10:57:32 2019 +0000) <slackline>
| * | | 4edf7b5 - updated path for /mnt/personal (Sat Jan 12 07:55:45 2019 +0000) <slackline>
| * | | 0b61635 - adding work_laptop profile (Wed Dec 19 12:34:16 2018 +0000) <slackline>
| * | | 71c7d3f - Adding config/.config/.pycodestyle (Tue Dec 18 16:32:52 2018 +0000) <slackline>
| | |/
| |/|
| * | 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>
最佳答案
我从未见过您执行 git fetch
或 git pull
,所以很可能您的本地分支与远程分支不同步。以下应该有效:
git fetch origin
git checkout kimura
git merge origin/master
git fetch
调用应该使用来自远程的最新更改更新您的本地跟踪分支 origin/master
。你也可以直接与 master
merge ,假设你已经 pull 了那个分支:
git checkout master
git pull origin master
git checkout kimura
git merge master
关于Git 起源在头后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54400086/
我正在编写一个 Point 类(在 3d 空间中)并且一直想知道创建原点的最佳方法是什么。这是基本类(取自 Andy 的示例,以防万一有人想知道基本实现是什么): struct Point {
所以我遇到了 MY: WARNING cannot transform class XYZ java.lang.RuntimeException: Method code too large!
我有一个在 Glassfish 下运行的 Java EE 应用程序。 经过最近的一些更改,我们开始在日志中看到大量语句: [#|2011-12-16T11:20:27.007-0800|INFO|su
使用UncaughtErrorEvent.UNCAUGHT_ERROR时是否可以获得错误和错误事件的目标/起源? 我正在使用复杂的Flash应用程序记录用户的运行时错误,并想知道哪里出现了问题。 Un
既然除了窗口大小之外什么都没有变化,我的程序需要一个完整的核心来在最大化的窗口上渲染场景是否正常? 我在 Windows 上使用 C++ 语言的 Qt 4.7 绘制 150 张尺寸为 1754*124
我正在尝试让我的 Chrome 扩展程序将文件上传到 Google 云端硬盘,但我在授权时遇到了困难。我一直在研究 here 中的代码和说明,但我不知道在开发者控制台中为“Authorized Jav
我在通过 webhook 与 GitHub 连接的服务器上运行 Jenkins。不幸的是,我的构建偶尔会失败,我不知道为什么。有时重新启动 Jenkins ( sudo service jenkins
我在使用 Atmosphere 框架 (https://github.com/Atmosphere/atmosphere) 构建的网络应用程序中启用 CORS 时遇到问题 我的请求类似于: /**
我正在使用 AngularJS 开发一个 Web 应用程序。它包含一个管理界面,该界面依赖于另一个域上的 json-rpc API。 在我的本地环境中,如果我向 API 服务器发出请求(使用 Angu
我正在开发一个同时使用 REST 端点和 SockJS websocket 的服务器应用程序。这曾经在 Spring 5.2 及更低版本下工作正常。 然而,从 5.3 版本开始 ,以下方法存在于org
我刚刚开始使用 angularjs,并且使用 Rails 作为后端 api。我已经成功设置了 Angular rails 资源( https://github.com/FineLinePrototyp
我是 React js 的新手,我正在尝试根据用户输入简单地动态更改 map 但是对于特定位置的搜索请求,此错误会增加 XMLHttpRequest cannot load https://maps.
我对一个我想到的项目做了一些测试,其中涉及使用附近的地方。所以我和大佬一起开始摆弄 Google 的 Places Api。我在我的 map 上使用带有 openstreet 瓷砖的传单。现在一切都很
我是一名优秀的程序员,十分优秀!