Skip to main content
1170 votes
24 answers
537k views

I accidentally dropped a DVD-rip into a website project, carelessly git commit -a -m ..., and, zap, the repository was bloated by 2.2 GB. Next time I made some edits, deleted the video file, and ...
culebrón's user avatar
  • 36.9k
4499 votes
42 answers
5.7m views

How do I delete a commit from my branch history? Should I use git reset --hard HEAD?
hap497's user avatar
  • 165k
2539 votes
19 answers
1.2m views

When is it recommended to use Git rebase vs. Git merge? Do I still need to merge after a successful rebase?
Coocoo4Cocoa's user avatar
  • 51.3k
4460 votes
22 answers
2.4m views

How do I easily undo a git rebase? A lengthy manual method is: checkout the commit parent to both of the branches create and checkout a temporary branch cherry-pick all commits by hand reset the ...
webmat's user avatar
  • 61.1k
422 votes
3 answers
162k views

Git's documentation for the rebase command is quite brief: --preserve-merges Instead of ignoring merges, try to recreate them. This uses the --interactive machinery internally, but combining it ...
Chris's user avatar
  • 10.3k
1046 votes
11 answers
236k views

I've been using Git now for a couple of months on a project with one other developer. I have several years of experience with SVN, so I guess I bring a lot of baggage to the relationship. I have ...
Micah's user avatar
  • 17.9k
1660 votes
17 answers
1.3m views

I have two branches. Commit a is the head of one, while the other has b, c, d, e and f on top of a. I want to move c, d, e and f to first branch without commit b. Using cherry pick it is easy: ...
tig's user avatar
  • 28.1k
831 votes
25 answers
603k views

How do you squash your entire repository down to the first commit? I can rebase to the first commit, but that would leave me with 2 commits. Is there a way to reference the commit before the first ...
Verhogen's user avatar
  • 28.9k
639 votes
6 answers
378k views

I am trying to understand the differences between git merge --squash <branch> and git rebase [--interactive] <base>. Depending on the command, I am not sure what new commits appear on the ...
GiH's user avatar
  • 14.7k
416 votes
5 answers
66k views

There's ways to change the message from later commits: git commit --amend # for the most recent commit git rebase --interactive master~2 # but requires *parent* How can you ...
13ren's user avatar
  • 12.2k
691 votes
8 answers
344k views

What's the difference between git merge and git rebase?
Daniel Peñalba's user avatar
295 votes
16 answers
78k views

I've asked before about how to squash the first two commits in a git repository. While the solutions are rather interesting and not really as mind-warping as some other things in git, they're still a ...
kch's user avatar
  • 80.2k
238 votes
9 answers
53k views

Suppose you have a history containing the three commits A, B and C: A-B-C I would like to combine the two commits A and B to one commit AB: AB-C I tried git rebase -i A which opens up my editor ...
Christian's user avatar
  • 10.2k
93 votes
3 answers
19k views

We have all heard that one should never rebase published work, that it’s dangerous, etc. However, I have not seen any recipes posted for how to deal with the situation in case a rebase is published. ...
Aristotle Pagaltzis's user avatar
530 votes
11 answers
219k views

I was working on a repository on my GitHub account and this is a problem I stumbled upon. Node.js project with a folder with a few npm packages installed The packages were in node_modules folder ...
Kartik's user avatar
  • 9,931

15 30 50 per page
1
2 3 4 5
21