OT: Squashing Git commits AFTER pushing them

23 views
Skip to first unread message

Jason Hsu, Rubyist

unread,
May 28, 2014, 5:51:37 PM5/28/14
to rubyonra...@googlegroups.com
BACK STORY: I'm working on the rubygems.org site.  So far, all I've done is fill in the missing details on setting up the project.  (The only two files I've changed are config/database.yml.example and CONTRIBUTING.md.)  I forked the project, made changes, pushed them, and submitted a pull request.  You can see the pull request at https://github.com/rubygems/rubygems.org/pull/690 .

I was told that I need to combine my multiple commits into one.  So I used the "git rebase" command, but there's one more step that I'm missing.  I'm told that I merged in the master branch but didn't rebase/squash the commits.

When I enter "git log", the output starts with:
commit 9f341298389e64c2fec62a6400c0529d014a42b2
Merge: 738e1b7 4d366e4
Author: Jason Hsu 
Date:   Mon May 26 14:30:47 2014 -0500

    Merge branch 'master' of https://github.com/jhsu802701/rubygems.org
    
    Provided username and password in config/database.yml.example; added missing
 setup details in CONTRIBUTING.md

commit 738e1b7cdb72e4e6fe142e181e9a148d1d57f10a
Author: Jason Hsu 
Date:   Fri May 23 12:31:30 2014 -0500

    Updated setup to include how to install old version of gems, how to install 
redis-server in Linux, and how to install PostgreSQL in Linux
    
    Added complete initrd and pg_ctl commands for getting started
    
    Changed formatting of commands to prepare Postgres
    
    Removed indents for Postgresql setup

What else do I need to do to combine all of the commits I made into just one?

Benjamin Iandavid Rodriguez

unread,
May 28, 2014, 6:10:13 PM5/28/14
to rubyonra...@googlegroups.com
Check the number of commits in your PR and do the following:

$ git reset --soft HEAD~<number_of_commits_in_pr>
$ git commit -m "<some message>"
$ git push --force origin <your_branch>


Your commits should be updated on the pull request also.

Hope this helps.


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9c5f4c69-41bd-41b7-9538-326ece9c4ca9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason Hsu, Rubyist

unread,
May 28, 2014, 10:59:05 PM5/28/14
to rubyonra...@googlegroups.com
Thanks.  This worked.  Next time, I'm creating and switching to another branch.
Reply all
Reply to author
Forward
0 new messages