Timeline for How do I squash my last N commits together?
Current License: CC BY-SA 3.0
27 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 18, 2022 at 14:01 | comment | added | Rafaël Moser |
And you can quit the editor by pressing ESC and typing :wq!
|
|
Nov 3, 2021 at 9:27 | comment | added | Prabhu U |
After rebase, if we want to push to remote, we need to use --force flag to push. If we don't use, push will fail. ` git push --force <remote> <remote_branch> `
|
|
Aug 17, 2021 at 10:26 | comment | added | Eduardo Pignatelli |
What if there are too many pick to replace manually?
|
|
Oct 11, 2019 at 10:55 | comment | added | Iulian Onofrei |
But shouldn't it be For example, if the user wishes to view 5 commits from the current HEAD in the past the command is git rebase -i HEAD~6 . instead?
|
|
Jun 9, 2019 at 3:33 | comment | added | ColinM |
git reset --soft $(git merge-base HEAD master) && git commit --reuse-message=HEAD@{1}
|
|
Feb 19, 2019 at 9:55 | comment | added | csey | Note that you can re-order commits when rebasing interactively - e.g. if you made commits A, B, then C, you can squash commit C onto A by swapping the order of the lines of B and C when prompted (and changing C to "squash"). Useful if you have committed more work since the commit you are trying to squash. | |
Nov 30, 2018 at 11:15 | comment | added | not2qubit |
@Geynen Thanks, that link provide the only description that made full sense. Now I can even tell people that <after-this-commit> , means exactly that. It is non-inclusive and will let you pick and squash commits after that one, as long as none of them are an initial commit. If you want to include initial commit, you need to use the git reset method instead.
|
|
Oct 23, 2018 at 21:09 | comment | added | jackrabbithanna | What you supposed to do after the squashing to get it pushed? | |
May 3, 2018 at 18:34 | comment | added | Geynen | Here is a practical example: feeding.cloud.geek.nz/posts/combining-multiple-commits-into-one | |
Mar 11, 2018 at 20:17 | comment | added | Spencer Williams |
I feel like you really mean <before-this-commit> , but you describe such an argument as a commit in the past.
|
|
Jan 5, 2018 at 11:24 | comment | added | CIRCLE |
It should be <after-and-including-this-commit>
|
|
Dec 11, 2017 at 19:45 | comment | added | polynomial_donut |
The explanation for <after-this-commit> is needlessly complicated. With a simpler explanation (the chosen words are almost self-explanatory, already, but the given explanation overcomplicates), this answer would be perfect.
|
|
Sep 29, 2017 at 14:48 | comment | added | Eric Schnipke |
@Cheeso, this article helps explain the squash and fixup designations used during an interactive rebase. Specifically, the squash and fixup designations tell Git how to combine the commit messages.
|
|
Feb 19, 2017 at 21:11 | comment | added | Alexander Mills | is there a way to squash using git rebase without using interactive mode? | |
Jul 27, 2016 at 3:18 | comment | added | Cheeso |
Use git rebase -i <after-this-commit> and replace "pick" on the second and subsequent commits with "squash" or "fixup", as described in the manual. uhhhh... wut?
|
|
Jul 23, 2016 at 6:16 | history | edited | Nivir | CC BY-SA 3.0 |
Command update
|
S Feb 3, 2016 at 22:52 | history | suggested | user2185573 | CC BY-SA 3.0 |
A better explanation of <after-this-commit>
|
Feb 3, 2016 at 22:29 | review | Suggested edits | |||
S Feb 3, 2016 at 22:52 | |||||
Jan 14, 2016 at 20:33 | comment | added | yoyodunno | I always end up screwing up the rebase for some reason, reset --soft seems more intuitive for most purposes. | |
Sep 15, 2015 at 9:31 | comment | added | zionyx |
The difference between this rebase -i approach and reset --soft is, rebase -i allows me to retain the commit author, while reset --soft allows me to recommit. Sometimes i need to squash commits of pull requests yet maintaining the author information. Sometimes i need to reset soft on my own commits. Upvotes to both great answers anyways.
|
|
Apr 2, 2015 at 19:36 | comment | added | joedragons | I personally found this article (git-scm.com/book/en/v2/Git-Tools-Rewriting-History) a lot easier to follow than the one linked (same site). | |
Mar 16, 2015 at 22:33 | history | edited | iwasrobbed | CC BY-SA 3.0 |
added 109 characters in body
|
Dec 8, 2014 at 18:31 | comment | added | interfect | If you've already pushed the commits, you will need to push -f to forcibly move the remote branch to your new commit. This will upset anyone who was working on top of the old commits, though. | |
Nov 4, 2014 at 12:04 | comment | added | joozek |
<after-this-commit> is commit X+1 i.e. parent of the oldest commit you want to squash.
|
|
Jun 6, 2012 at 4:43 | history | edited | CommunityBot | CC BY-SA 3.0 |
http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html was remapped to http://git-scm.com/docs/git-rebase by Sam Saffron (17174)
|
Mar 8, 2011 at 4:00 | vote | accept | markdorison | ||
Mar 4, 2011 at 4:18 | history | answered | Anomie | CC BY-SA 2.5 |