Skip to main content

Questions tagged [git-squash]

git squash is the command used to rewrite git history before it is pushed to the remote.

9 votes
1 answer
23k views

Squashing (already pushed) commits on GitLab

I have a merge request with 5 commits, all pushed to the branch on GitLab. I'd like to squash those 5 commits into 1 -- but there are intermediate commits to the repo by other people. E.g.,in git log, ...
user319407's user avatar
2 votes
0 answers
512 views

How to merge Feature, Develop and Main without leaving branches ahead/behind (github)

We have an issue that whenever we merge into main, develop and main continue to be out of sync. We have: Main - production Develop stage Feature branches (temporary) At the start of this, Main and ...
iamonkey's user avatar
  • 151
2 votes
1 answer
74 views

How to combine multiple historic commits into one while not touching the recent ones?

I want to combine multiple historic commits together, while not touching the recent ones, as shown in the picture, I want to only combine the 2-4 commits together. After reading relevant answers and ...
LWang's user avatar
  • 95
1 vote
0 answers
284 views

How to squash commits that contain merge commits without re-resolving conflicts?

I've been working on a long running branch and I've been pulling another branch (develop) into my branch every so often. I've also been making small WIP (Work in Progress) commits as I go along. I'd ...
jonathanbell's user avatar
  • 2,547
0 votes
2 answers
146 views

Git: Squash commits older than conflicting merge

I would like to squash some commits that are older than a "conflicting" merge. E.g.: main branch: A--B--C--D--G--H dev branch: \-E--F----/ H is my current head, G is the conflicting ...
Marius Melzer's user avatar
3 votes
1 answer
5k views

How to squash commits that contain a merge commit

Is there a way to squash commits that have a merge commit? I am able to squash when there is not any merge commits but I don't know how to do it when there is one. Like these two commits.
Burak Akyalçın's user avatar
-1 votes
2 answers
1k views

Git how to squash all the commit [duplicate]

I have try to use git rebase -i HEAD~3 to squash all the commit. But git throw below error, for the commit HEAD~3 is not exist. fatal: invalid upstream 'HEAD~3' $ git log --oneline 7cabc02 (HEAD -&...
LF-DevJourney's user avatar
0 votes
1 answer
618 views

How can i do git rebase after git pull request?

I have a trouble git rebase. because, I had pushed my local code to origin dev. And, I send a pull request to 'upstream'. But, There are 1 PR and 7 commits like below the picture I want to 7commits ...
devsner's user avatar
  • 399
0 votes
3 answers
871 views

Lost changes during squash with rebase

I try to run git rebase -i HEAD~N to squash my older commits into one. But sometimes I got a Merge conflict. The problem is, even if I resolve the conflict and do a "git rebase --continue",...
Paxi's user avatar
  • 121
2 votes
1 answer
3k views

Git squash commits with same commit message

Is there a simple Git command to squash all commits with the same commit message to one commit in a new branch? A simple command seems to me: git merge --squash BRANCH_WITH_SAME_COMMIT_MESSAGES The ...
BuZZ-dEE's user avatar
  • 6,637
2 votes
3 answers
774 views

Do I have to clean password from branch commit history if I do squash merge?

I accidentally committed a password to a feature branch and synced that branch to remote. I tried to clean the branch commit history with bfg without success and with git-filter-repo I'm having other ...
Mathias Rönnlund's user avatar
3 votes
3 answers
2k views

Is there an easy way to squash many commits in git?

I have the following issue: I have many commits that need to be squashed (several thousand, we had a runaway script). Those commits are in groups between 40 to 200. Using git rebase -i is not feasible ...
Pingger Shikkoken's user avatar
1 vote
1 answer
137 views

Squash many pushed commits before merging into main

In a big refactoring branch, I was forced to do commits due to some git flaw (git loses track/history of moved files if too much of the content changes before committing), which left the repository ...
Robin Holenweger's user avatar
8 votes
2 answers
2k views

How to automatically rebase all children branches onto master after squashing and merging the parent branch?

Building on this question, I have a workflow where I'm constantly making PRs on top of PRs to make it easier for others to review my work. Goal is to have smaller PR sizes. So I often end up with ...
giwofe5619's user avatar
1 vote
1 answer
2k views

git history screwed up

I was trying to do rebase to combine the commits into one single commit, but I ended up writing more commits and now its all screwed up big time. Here is the tree: on running git status, I get On ...
harry123's user avatar
  • 870

15 30 50 per page
1
3 4
5
6 7
15