Skip to content

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

Description

@Bpazy
vim ~/.gitconfig
[user]
    name = Your Name
    email = example@example.com
[alias] 
    mt = "!gitmergeto() { git pull && 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 分支上处理。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions