Question

I have gone through a huge refactoring effort and would like to push my local git branch (call it local_b) into a temporary remote branch which my CM can deploy in a dedicated environment for the QA to test. However, before some testing is done, due to the risks involved, I would rather not merge it into the ultimate target remote branch (call it official_b) that my local branch tracks, i.e. from which I fetch other developers' changes.

Is it possible for me to:

  1. Promote local_b to the remote (call that new remote branch test_b)

  2. Keep the local branch as tracking the official_b for synchronizing with incoming merged changes from other developers

  3. Push all changes from local_b (merged changes from official_b + my local changes) into test_b

all at the same time using some git gimmick?

Was it helpful?

Solution

If I do not understand wrong, you want to push your local_b branch and update it with the changes done in official_b.

For pushing your local branch to the remote:

git push origin local_b:test_b

And for updating your branch:

git checkout local_b
git rebase official_b
# ... Fix possible conflicts
git push origin local_b:test_b 

OTHER TIPS

I don't see why not:

# Promote local_b to the remote (call that new remote branch test_b)
git push origin local_b:test_b

# Push all changes from local_b (official_b + my local changes) into test_b
git push origin local_b:test_b  # so yes, same command as earlier...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top