“git checkout main_branch; 的别名” git 合并 topic_branch”?
在我们的团队中,我们使用开发、暂存和主分支以及问题分支。通过这个工作流程,我发现自己做了以下很多事情:
例如在开发分支中:
git checkout staging; git merge development
有人有一个简单的别名吗?
它应该是这样的:
merge_with master
会做:
git checkout master; git merge previous_branch
In our team we are using a development, staging and a master branch plus branches for issues. With this workflow I find myself doing a lot of the following:
For example in the development branch:
git checkout staging; git merge development
Does anyone have a simple alias for this?
It should be something like:
merge_with master
would do:
git checkout master; git merge previous_branch
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以使用以下命令为其分配一个别名:
这样
git mm
会将您当前的分支合并到 master 中。You can assign an alias to that using:
So that
git mm
will merge your current branch into master.如果发生冲突,
git merge
始终在当前分支上执行,因此您必须首先签出暂存分支。但是,如果允许线性历史记录,您可以使用 git rebasedevelopment staging 。
正如迈克尔所说,你总是可以创建一个别名。
编辑:将其添加到 .git/config 即可
git merge
is always performed on the current branch in case of conflict, so you have to checkout the staging branch first.However, if linear history is permitted, you can use
git rebase development staging
.As Michael said, you can always make an alias.
EDIT: Add this to .git/config will do it
应该给你一个
should give you one as
感谢您的帮助。没有一个完全符合我的要求,但确实让我朝着正确的方向前进。
我已将以下内容添加到 ~/.bash_login 中。对于每个 git 存储库,“merge_to somebranch”都会执行 git checkout somebranch; git 合并上一个分支。
Thanks for all your help. None of all did exactly what I wanted but did get me in the right direction.
I have added the following to ~/.bash_login. For every git repository "merge_to somebranch" will do git checkout somebranch; git merge previousbranch.
这就是我的意思,只是它还不起作用。
首先它找出当前分支是什么。然后它使用它来确定要合并的分支。
所以接下来的事情是找出如何附加别名参数......
Here is sort of what I mean except it does not work yet.
First it finds out what the current branch is. Then it uses that to determine which branch to merge with.
So the next thing is to find out how to append an alias argument...
我一直在这样做,特别是因为在我们的一个项目中,我们有几个略有不同的生产分支。部署修复/更新可能会让您的手指感到疲劳。
对于所有 Windows 用户:我刚刚在我的 %path% 中的某个位置创建了一个 merge.bat 文件,它包含:
然后我所做的就是
它运行:
I'm forever doing this, especially since on one of our projects we have several subtly different production branches. Deploying a fix/update can make your finger's tired.
For all you Windows bods out there: I've just created a merge.bat file somewhere in my %path% and it contains:
then all I do is
and it runs: