Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating a local fork without pushing merge commits?

I seem to be having some issues with merge commits crowding my pull requests that I don't mean to be pushed. Currently I have a local fork with an upstream set to the base repository, and I update my repository like so:

git fetch upstream
git merge upstream/n3960  

where n3960 is my branch I am working on, the problem is when I push commits to my fork, I get all of these Merge remote-tracking branch 'upstream/master' into n3960 commits from when I updated my branch whenever another member pushes to the base repo, how can I avoid having all of these merge commits in my pull requests?

An example: my recent pull request is crowded with these Merge remote-tracking branch 'upstream/master' into n3960 commits, I want to try and avoid having these overcrowd my actual commits!

like image 759
Syntactic Fructose Avatar asked Jun 02 '14 14:06

Syntactic Fructose


1 Answers

You don't have to merge.

You can:

# rebase n3690 on top of upstream/master
git checkout n3690
git rebase upstream/master

# then
git push -f 

By forcing the push, that will update automatically your current Pull Request.

And the rebase avoids all those merge commits.

like image 90
VonC Avatar answered Oct 05 '22 10:10

VonC