在主分支上获取最新的代码并合并到我的功能分支上的单一操作?

问题描述 投票:0回答:1

很多时候,我只是想在开始编码前确保我已经合并了最新的代码。这些步骤通常包括

  1. 储存并撤销我在当前devfeature分支上的修改。
  2. 查看主枝
  3. 获取最新的主代码
  4. 换回我的分支
  5. 从主站合并到我的分支上

我每天码字前都会这样做,以避免最终要合并到主站时发生冲突。有没有一个简单的一键操作,这样我就可以节省时间?

git branching-and-merging
1个回答
0
投票

我发现这叫做 重新归类。


0
投票

从你的功能分支。

git stash
git fetch
git merge origin/master
git stash pop

或者更方便的用别名。

git config --global alias.up '!git stash && git fetch && git merge origin/master && git stash pop'

# then each time you need it, from your feature branch :

git up

0
投票

非常简单。了解git rebase。URL

© www.soinside.com 2019 - 2024. All rights reserved.