I create a new branch in Git:
git branch my_branch
Push it:
git push origin my_branch
Now say someone mad
git branch --set-upstream-to=origin/master<branch_name>
You can make this happen with less typing. First, change the way your push works:
git config --global push.default current
This will infer the origin my_branch part, thus you can do:
git push -u
Which will both create the remote branch with the same name and track it.
You can also do git push -u origin $(current_branch)
All i wanted was doing something like this:
git checkout -b my-branch
git commit -a -m "my commit"
git push
Since i didn't found a better solution, i've just created an bash alias on ~/.bashrc:
alias push="git push -u origin HEAD"
now just doing a push command does the job (you can add this alias on ~/.gitconfig too with another name, such as pushup)
We use phabricator and don't push using git. I had to create bash alias which works on Linux/mac
vim ~/.bash_aliases
new_branch() {
git checkout -b "$1"
git branch --set-upstream-to=origin/master "$1"
}
save
source ~/.bash_aliases
new_branch test #instead of git checkout -b test
git pull
I sort of re-discovered legit because of this issue (OS X only). Now all I use when branching are these two commands:
legit publish [<branch>]
Publishes specified branch to the remote. (alias: pub)
legit unpublish <branch>
Removes specified branch from the remote. (alias: unp)
SublimeGit comes with legit support by default, which makes whole branching routine as easy as pressing Ctrl-b.