0

Possible Duplicate:
Are there any Git command to combine all our ugly commits together to one?

I've downloaded public git repo and fixed some stuff. I made several commits, mostly with random messages like "dsadsadsadasd". Now I want to push back those changes but not as 10 messy commits but as one with good message. How can I merge those commits into one before pushing?

Community
  • 1
  • 1
Andy
  • 13
  • 2

4 Answers4

2
git reset --soft origin/branchname
git add -A
git commit -C HEAD@{1}

That's the fastest way to do it. Replace -C HEAD@{1} with -m "some other message" if you want a new message instead of the last one that you put in.

Hope this helps.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
1

Use git rebase -i and squash together your commits

http://kernel.org/pub/software/scm/git/docs/git-rebase.html

manojlds
  • 290,304
  • 63
  • 469
  • 417
0

Git Rebase... make sure you don't rebase after you've pushed. Also, if you pulled from github, you'll have to fork the repository and add your remote. After you've successfully pushed to your fork, you'll have to add a pull request on the original repository through the web browser.

http://kernel.org/pub/software/scm/git/docs/git-rebase.html

Homer6
  • 15,034
  • 11
  • 61
  • 81
0

Use git rebase -i HEAD~3 to launch an interactive rebase. This lets you squash any selected commits and re-order if you want.

patthoyts
  • 32,320
  • 3
  • 62
  • 93