Reputation: 31
I have a 'master' branch, and a 'bugfix' branch. this bugfix branch needs to be always updated with master commits, but i need to push to its own branch.
i tried
git branch -f --track bugfix origin/master
and tried set-upstream too but seems to set both, pull and push from/to 'master'.
Upvotes: 1
Views: 96
Reputation: 3031
How about
mkdir -p git
cd git
git clone https://github.com/user/repo.git
cd repo
git branch bugfix
git checkout bugfix
git push origin bugfix
git checkout master
git branch --set-upstream-to=bugfix
echo 'hallo' > hallo.txt
git add hallo.txt
git commit -m 'lolz'
git config push.default upstream
git push
So it will push master to origin/bugfix and pull origin/bugfix to bugfix.
Upvotes: 1
Reputation: 4242
If you pull the remote master branch into master by doing a git pull you can push it to the remote bugfix branch like this:
git push origin master:bugfix
That is assuming the name of your remote is origin.
I hope this is what you meant.
Upvotes: 1