Folks,
This is my use case: I have 3 branches, all three are remote tracking branches.
git branch
release-alpha
* release-allUS
master
Now I added a new file in release-allUS branch, I made a commit by doing this:
git add filter_driver.rb
git commit -m "driver code"
Now I want to push only this file to the remote release-allUS branch, How do I do that? Thanks a lot for any feedback.
Since all that you committed locally was that one file, a git push
to your remote will work. Push will only push what has been committed locally.
git push origin release-allUS
As manojlds pointed out in the comments, this will only work if nothing else has been stages and there are no other unpushed local commits. If that is the case, you are are probably best creating a new tracking branch from the remote, cherry picking the local commit into the new branch, pushing to the remote, then rebasing the original tracking branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With