* 9dbd857 (hotfix-correct-java-jdk-path, feature/add-ansible-galaxy-requirements-file) requirements.yml: adds maven and nodejs requirements
* 1643619 (QOL-1640-enable-vpc-peering) roles/ansible-linux-commons: change value of hostname in cloud-init
* b5fd2a4 roles/bamboo-agent: add bitbucket ssh host key to /etc/ssh/ssh_known_hosts
* d5cc1f7 vpc cfn template: produce outputs conditionally
* 3b87efe vpc cfn template: use csv for subnet/AZ mapping
* 2e93096 roles/bamboo-agent: Install chrome on agents
* 9aeb07e roles/bamboo-agent: install chromium browser
* 89e852d (HEAD -> feature/QOL-1649-install-chrome) README: display the current directory structure of inventories
* 1f55c4b inventories/test: define root volume size
* 07d902e bamboo-ec2 cfn: specify root volume size
这是我的(最近)历史。
我希望 feature/QOL-1649-install-chrome
向上移动一个提交,到 9aeb07e
。
我试过 cherry pick,但后来我得到了一份提交到 feature/QOL-1649-install-chrome
分支的“副本”。但我想要的(我认为)是快进。
最佳答案
您可以 git reset
到它,但为了一般的安全和清洁,我更喜欢使用 git merge --ff-only
.要使用它,检查你想要快进的分支(你已经),然后运行 git merge --ff-only <commit-hash>
:
git merge --ff-only 9aeb07e
我经常使用这个命令,所以我为它起了一个别名,git mff
( merge 快进)。
编辑,2020 年 11 月:请注意,您不必在此处使用原始哈希 ID; git mff origin/somebranch
也很好用。您可以在此处使用原始哈希。这是 Git 中通用规则的一部分:如果可以使用原始哈希,则可以使用分支名称、标签名称、远程跟踪名称等。
围绕此一般规则有一些特殊情况,特别是,如果您使用带有 git checkout
的原始哈希 ID命令,您将得到 Git 所谓的分离的 HEAD,而如果您使用带有 git checkout
的分支名称,你将“在分支上”(即 attached HEAD: 与 detached 相反,尽管 Git 文档从未这样调用它:它只是说“在分支上”)。新git switch
命令,在 Git 2.23 及更高版本中,在这方面更好,因为如果它要切换到分离头模式,它要求您添加 --detach
选项。有了这个git mff
别名,但是,没有什么特殊情况需要担心。
关于git 快进一次提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45155486/