Linked Questions
171 questions linked to/from How do I squash my last N commits together?
862
votes
13
answers
654k
views
How to squash commits in git after they have been pushed?
This gives a good explanation of squashing multiple commits:
http://git-scm.com/book/en/Git-Branching-Rebasing
but it does not work for commits that have already been pushed. How do I squash the most ...
284
votes
26
answers
235k
views
Git error: Encountered 7 file(s) that should have been pointers, but weren't
How to clean repo, if staged files marked as modified?
After
git reset --hard
I get
Encountered 7 file(s) that should have been pointers, but weren't:
Running git clean -fdx (which deletes ...
694
votes
9
answers
210k
views
Squash the first two commits in Git? [duplicate]
With git rebase --interactive <commit> you can squash any number of commits together into a single one.
That's all great unless you want to squash commits into the initial commit. That seems ...
266
votes
9
answers
423k
views
Undo a merge by pull request?
Someone accepted a pull request which they shouldn't have. Now we have a bunch of broken code merged in. How do you undo a pull request? I was just going to revert the changes to the commit just ...
132
votes
14
answers
75k
views
Undo git reset --hard with uncommitted files in the staging area
I am trying to recover my work. I stupidly did git reset --hard, but before that I've done only get add . and didn't do git commit. Please help! Here is my log:
MacBookPro:api user$ git status
# On ...
238
votes
3
answers
159k
views
What does it mean to squash commits in git?
What does Squashing commits in git mean. How do I squash commits in Github?
160
votes
5
answers
220k
views
How can I combine two commits into one commit?
I have a branch 'firstproject' with 2 commits. I want to get rid of these commits and make them appear as a single commit.
The command git merge --squash sounds promising, but when I run git merge --...
263
votes
2
answers
330k
views
How to cherry pick from 1 branch to another
I have 2 branches, master and dev.
I am on dev branch and I want to cherry-pick 1 commit from master to dev. So I did
$ git cherry-pick be530cec7748e037c665bd5a585e6d9ce11bc8ad
Finished one cherry-...
147
votes
8
answers
55k
views
Is there a way to squash a number of commits non-interactively?
I'm trying to squash a range of commits - HEAD to HEAD~3. Is there a quick way to do this, or do I need to use rebase --interactive?
105
votes
6
answers
76k
views
git rebase after previous git merge
I have the following situation:
I created a clone(Y) from a main repository(X), because there were many people working on Y we didn't do any rebase but only merges. When we want to deliver(push) Y to ...
54
votes
20
answers
115k
views
Git push remote rejected {change ### closed}
i am having problems pushing my changes from my local master to remote master because of this error:
remote: Processing changes: refs: 1, done
To ssh://[email protected]:29418/xxxxxx
! [...
57
votes
4
answers
45k
views
How to make git merge handle uncommitted changes to my working tree?
A co-worker and I are both working on the master branch at the moment. I have some code in my working tree that I don't want to commit (debugging statements and the like). Now if he commits changes ...
48
votes
5
answers
30k
views
How should I move changes from one commit to another?
I have two commits on the same branch, one right after another. I added changes to file A to the first commit, and then I made some changes to other files and then made another commit. Now I want the ...
55
votes
2
answers
79k
views
How can I overwrite or replace a commit with new one once I have pushed to remote?
So I'm working on a sensitive project with a group and all our sources are on Github. I recently pushed a commit and later realized there were lot of mistakes in my push. I've since fixed all those ...
20
votes
2
answers
22k
views
rebase to squash multiple commits on same branch
Can we use rebase to squash multiple commits into one single commit on the same branch?
Taking an example, i have created two topic branches - issueA_1 and issueA_2 from master. I make a couple of ...