1

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'.

2 Answers 2

1

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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.