Skip to content

Instantly share code, notes, and snippets.

@ronaldmansveld
Created August 18, 2016 09:51
Show Gist options
  • Select an option

  • Save ronaldmansveld/36313669c6e04555f47e790c090cf853 to your computer and use it in GitHub Desktop.

Select an option

Save ronaldmansveld/36313669c6e04555f47e790c090cf853 to your computer and use it in GitHub Desktop.
Alias for checking out branch + merging latest master automatically
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
_git_com()
{
_git_branch
}
[alias]
com = "!f() { git co master && git up && git co ${1} && git up && git merge master; }; f"
@ronaldmansveld
Copy link
Author

Files go into your home directory. Type 'echo ~' in git bash to see what is set as your home directory.

The .bash_profile and .bashrc are only needed when you want autocomplete on branchnames for this alias.

Depending on your setup, you may be asked for your password twice, once for updating master, and again for updating the target branch.

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