Linked Questions

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 ...
Loren's user avatar
  • 14.6k
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 ...
Kate Zz's user avatar
  • 3,502
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 ...
kch's user avatar
  • 79k
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 ...
Will's user avatar
  • 10.3k
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 ...
eistrati's user avatar
  • 2,344
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?
Lakshmanan Meiyappan's user avatar
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 --...
Don P's user avatar
  • 62.5k
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-...
michael's user avatar
  • 109k
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?
Phillip's user avatar
  • 5,556
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 ...
INS's user avatar
  • 10.7k
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 ! [...
Jono's user avatar
  • 17.9k
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 ...
Jeremy Huiskamp's user avatar
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 ...
Rose Perrone's user avatar
  • 62.9k
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 ...
sparta93's user avatar
  • 3,814
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 ...
faizal's user avatar
  • 3,537

15 30 50 per page
1 2
3
4 5
12