Linked Questions

16 votes
2 answers
33k views

GIT: how to squash several commits that have been pushed to a remote repo?

I have a weird setup with Git. Basically I have: [client 1] <---> [remote repo] ----> [client 2] [Client 1] is essentially the local repo I am working with, because I can't compile/build ...
wei's user avatar
  • 6,809
11 votes
3 answers
18k views

What happens when you git push but someone else has already committed something you don't have on your local repo?

Sorry, I'm quite a newbie at Git, and it is hard to find answers for such hard-to-phrase questions (at least for me) on Google. Say my name is Joe, and I'm working on a software program with my ...
Joseph's user avatar
  • 1,043
16 votes
1 answer
10k views

squash more then two commits in sourcetree?

I have a large number of commits, about 20, that I've done since my last push to origin/master. I have never had more than one branch, master, and all commits were done on master. How can I squash ...
mark-hahn's user avatar
  • 461
18 votes
4 answers
2k views

Squash and merge master into same branch

Is there a way to squash and merge master into the same branch? Effectively taking all the pending commits and putting them into 1 commit? My original idea is a script that takes my-branch and does a ...
CuriousDeveloper's user avatar
6 votes
5 answers
5k views

Uncommit all commits in current branch but leave all changes at the current state

I have a branch A in my repo with 10 commits. What I want is to find a way to delete all commits but leave all changes in the current branch (so the state of the code would be the same but all commits ...
user3139545's user avatar
  • 7,234
10 votes
3 answers
6k views

How do I reduce the size of a bloated Git repo by non-interactively squashing all commits except for the most recent ones?

My Git repo has hundreds of gigabytes of data, say, database backups, so I'm trying to remove old, outdated backups, because they're making everything larger and slower. So I naturally need something ...
sanmai's user avatar
  • 30.3k
6 votes
2 answers
7k views

Cleaning up the branch history in Git

I'm working on a feature branch for days. During this time I did so many mistakes and committed so many unnecessary code changes, which I had to revert in the next commit. Finally, I found the best ...
user1941537's user avatar
  • 6,463
12 votes
3 answers
3k views

How to squash my git branch commits into the same branch without rebasing?

I have a local branch, we're using git-flow with Pull Requests and I'm looking to squash a few commits after receiving PR feedback. How can I squash all my commits (from PR's for example) into the ...
Michael Durrant's user avatar
8 votes
2 answers
6k views

How to uncommit in github for mac?

I'm using github for mac, the GUI for git that github provides, and I reverted a commit in the history. I then decided I wanted to revert that again, and.... long story short, I have a bunch of ...
GiH's user avatar
  • 14.4k
4 votes
3 answers
3k views

Why do dropped commits from a git rebase cause merge conflicts?

My Problem I have been working on a git repo. Before publishing my changes, I'd like to remove some commits - a023b43, 315424b and 7b51754 - as they do not reflect any meaningful changes. The only ...
Adam Matan's user avatar
  • 134k
5 votes
3 answers
13k views

How to squash commits in Git?

I am trying to squash my commits and merge my branch to master as one single commit. This is what I'm trying. I switch to master branch and then i do git merge --squash <branch_name> And I ...
Ankur Bansal's user avatar
7 votes
4 answers
2k views

How to tell if git branch has been fully merged after squash

When merging branches with --squash, git does no longer seem to be able to determine whether a branch has been fully merged. How can I quickly check this with existing git commands? To reproduce, ...
digory doo's user avatar
  • 2,192
5 votes
3 answers
1k views

Should I squash small, development commits into bigger ones?

There are (too) many questions regarding how to squash commits for git and other DVCS, such as: Squash my last X commits together using Git How to squash all git commits into one? Joining various ...
Petr's user avatar
  • 63.1k
7 votes
1 answer
3k views

Can I squash _other peoples_ git commits in a submitted PR?

I have received a PR and wish to squash the commits so it's nice. I'm not sure if I can do it or the respective authors have to do it? Of course, I wish to keep the author's name referencing their ...
Pure.Krome's user avatar
  • 86.2k
4 votes
1 answer
4k views

Git rebase squash commits by hash

I have a branch with around 10 commits. 3 of these are merge commits merging master to my branch and adding ~500 commits in between each time. Is there a way to squash commits that were made on the ...
ayushgp's user avatar
  • 5,031

15 30 50 per page
1 2 3
4
5
12