Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

利用 Git alias 快速合并当前分支到目标分支 #319

Open
Bpazy opened this issue Jan 25, 2024 · 0 comments
Open

利用 Git alias 快速合并当前分支到目标分支 #319

Bpazy opened this issue Jan 25, 2024 · 0 comments

Comments

@Bpazy
Copy link
Owner

Bpazy commented Jan 25, 2024

vim ~/.gitconfig
[user]
    name = Your Name
    email = example@example.com
[alias] 
    mt = "!gitmergeto() { export tmp_branch=`git branch | grep '* ' | tr -d '* '` && git checkout $1 && git pull && git merge $tmp_branch --no-edit && git push && git checkout $tmp_branch; unset tmp_branch; }; gitmergeto"

然后就可以使用 git mt master 将当前分支合并到 master 并 push 再切换回当前分支,如果遇到了合并冲突,则会保留在 master 分支上处理。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant