2012年6月1日 星期五

GIT: Push to remote branch of remote repo

Push to remote branch of remote repo

git push <remote_name> +<br_name>:refs/remotes/<my_name>/<br_name>

I suddenly realize this is a convenient command to push updates to each working copy, which may have the same branch name checkout. Git wont allow you to push to a checkout branch. This prevent that from happening.

Make an alias for this:
[alias]
rpush = !sh -c 'git push $1 +HEAD:refs/remotes/$2/$3' -
Then you can do:
git rpush <remote_name> <my_name> <br_name>




Aliases - Git SCM Wiki
https://git.wiki.kernel.org/index.php/Aliases#Advanced_aliases_with_arguments

沒有留言: