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.

git-squash
0 votes
0 answers
19 views

Git Showing Same Line Removed and Added after Merging Master into Feature Branch [duplicate]

After I merged from master, there were a few conflicts which I resolved, I am seeing various files having the same line deleted and added back in. I am not sure where this is coming from or how to ...
Samuel's user avatar
  • 31
-1 votes
2 answers
89 views

How to convert GitHub squash and merge commits to merge commits?

I have a personal project GitHub repository that used the squash and merge option for pull requests. How do I rewrite the Git history so that the pull requests used the merge commit option instead of ...
Jacob Guiang's user avatar
0 votes
1 answer
91 views

git thinks branch missing commits merged earlier

My team has recently transitioned to a GitHub Actions CI/CD workflow and we are encountering an issue that I'm uncertain how best to resolve. First, I'll describe our current branching strategy: We ...
NoxelNyx's user avatar
  • 997
1 vote
3 answers
372 views

How does git handle squash merge vs normal merge?

Let's say we have a Pull Request merging the commits from branch A into branch B, and we can perform the merge with normal merge and squash merge. And if we first perform the merge with squash merge (...
Jason Yu's user avatar
  • 2,022
1 vote
0 answers
59 views

My interactive rebase squash ends up with more commits instead of reducing them. What am I doing wrong?

I have a branch named myBranch, which I'm working on for a complex feature for a long time. After I finished my work and wanted to open a merge request, gitlab showed that 47 commits was done in my ...
uylmz's user avatar
  • 1,532
0 votes
1 answer
49 views

Change git history of PR merged long time ago from commit method to squash method

Hello to the community! As you can see in the diagram there is a commit (cm1) that includes a lot of binary files that was committed in a local branch. This commit was reverted at cm2 and at the final ...
Nebula's user avatar
  • 51
1 vote
0 answers
60 views

How to rebase old commits (squashed in target) as empty?

We have a setup with two repositories, dev repository and deploy repository (can't change that) with rebase-only merge strategy. Initially dev repo looked like this: main: A -> B -> C -> D ...
Virgileo's user avatar
-1 votes
2 answers
440 views

Unknown revision or path not in the working tree on git reset --soft

I want to squash all the commits till a particular commit-id in a branch. I tried using the command git reset --soft HEAD~223 The number 223 was generated as follows: I ran the command git rev-list ...
pensee's user avatar
  • 465
1 vote
1 answer
64 views

Git rebase branch onto squash merge

I did a mess with my features branches. What I had: master: A - B \ branch1: E - F \ branch2: G - H And then I squashed and merge ...
Chana Drori's user avatar
0 votes
2 answers
137 views

best git practice to avoid squash

I have been using squash with the steps below and I find it really time consuming and error prone git rebase upstream/develop git merge-base mylocaldev upstream/develop (this will display a commit ...
user3277841's user avatar
0 votes
1 answer
48 views

How to merge multiple commits onto another branch with multi (number of co developers) squashed commit?

Now there is a branch(branch1), three people P1 P2 P3 they develop together on branch1 with the comimit log P1 commit1 P2 commit2 P3 commit3 P3 commit4 P1 commit5 P2 commit6 ... P1 commit100 ...
moe_sakura's user avatar
0 votes
2 answers
497 views

squash hundreds of commits and rebase kicks off a large conflict resolution

I have a "long lived feature" branch that i have been working for last 2 months. It has 211 commits that i want to squash into single commit before this "long lived feature branch" ...
ASy_Dev's user avatar
  • 11
3 votes
2 answers
97 views

How can I merge all my local commit before rebase my local branch from the main?

When I work in a team and must push my local branch to the remote main, I rebase firstly my local branch to master with this simple command: git fetch && git rebase origin/main But when I do ...
okli's user avatar
  • 33
2 votes
1 answer
99 views

How to have one branch with full history and one branch with squashed history?

I have are requirement that the main branch has only one (potentially big) commit per issue ID. However, to confirm to the best practice of small commits, I also need to create and keep(!) multiple ...
Marco Eckstein's user avatar
0 votes
1 answer
166 views

Git squash N-consecutive commits in the middle of the branch history

Let's say I have several consecutive commits, we name them A0..A99 for simplicity, pushed by the same author to the main branch: these commits are not the last commits pushed to the main branch as ...
simone.tino's user avatar
  • 2,380
0 votes
0 answers
39 views

Can't fully squash commits

The commit Paises ISO 3166-1 all modify the same files and leave them in the same state. Is there any way to make it so there's only 1 commit Paises ISO 3166-1 on the blue line right before the ...
Daviid's user avatar
  • 1,489
2 votes
2 answers
159 views

Squashing first few dozens of git commits that contain merge commits

I have an existing repository that has root R, then a few dozens of commits including multiple merges, up to X, and then linear history up to Y. I'd like to squash everything from R to X into a single ...
Xilexio's user avatar
  • 1,228
2 votes
1 answer
685 views

Cannot squash merge in GitHub Desktop

When trying to squash merge 3 commits in GitHub Desktop, I was warned with the following error message: Unable to squash. Squashing replays all commits up to the last one required for the squash. A ...
Paris Geis's user avatar
0 votes
1 answer
669 views

squash commits in git and remove "ugly" merge message

I am trying to squash 2 commits and remove merge part, but have some problems. I have branch main and featureBranch. In my terminal I do: git checkout main git merge --squash featureBranch git push ...
Kratos's user avatar
  • 841
0 votes
0 answers
49 views

How to fetch changes from a forked repository which is a subtree

So I have an issue wherein I forked Repository A to create Repository B. Then I added Repository B into a subdirectory of Repository C via the subtree command as follows: git subtree add --prefix={...
user3684314's user avatar
0 votes
0 answers
42 views

Delete/Squash old commits while keeping the changes that they introduced [duplicate]

I'm trying to delete/squash a bunch of old commits that I don't want on my git history which were just made to put together code from multiple locations that were not using git (local folders from ...
Girog's user avatar
  • 1
1 vote
0 answers
12 views

Squashing commits not in series using git rebase [duplicate]

I have multiple commits done on a branch for a C project and would like to squash them into just two commits. Commit 1 - should have only the changes to the actual functionality source code Commit 2 - ...
Engineer999's user avatar
  • 3,873
1 vote
1 answer
515 views

Squash git commits by author [duplicate]

I have a repository to which several (3) authors contributed commits to the same branch of the repo. I want to merge it to the repository from which it was forked, but the admin of that repository ...
John's user avatar
  • 481
0 votes
1 answer
81 views

Git: remove some commits from a branch

Let's say I have, in a given working branch, a history of commits that looks like the below: commithash1 [task-a] lorem ipsum commithash2 [task-a] dolor sit amet commithash3 [task-b] consectetur ...
darksoulsong's user avatar
1 vote
3 answers
268 views

How to correct bug in merge - squash fix commit to merge commit

this should be probably very easy, but I am not able to solve it out. I introduced bug in the merge, and than I corrected it in additional commit. I would like to squash the "bug fix" commit ...
Jakub Znamenáček's user avatar
0 votes
1 answer
307 views

Squashing commits gone wrong [duplicate]

Say I have pushed two commits and I and try to squash them. Instead of doing git rebase -i HEAD~2 - I accidentally do git rebase -i HEAD~3 Here the 3rd last commit is from someone else but it would ...
R11G's user avatar
  • 1,940
0 votes
1 answer
77 views

Undo git commit message in 2 different branches (develop and feature) after git push

do not want to break anything in the master branch. I forked a develop branch through below commands git checkout develop git pull upstream develop # pull the updates locally based on the git push ...
Ahamed Kamal's user avatar
8 votes
1 answer
1k views

Branching from a feature branch and reconciling commits after main squash merge

I have the following situation: I've worked on a feature branch (called work1) to which I have an outstanding PR. While I wait for the PR to be approved, I want to start working on a new feature ...
Leonardo's user avatar
  • 1,703
0 votes
1 answer
132 views

How Can I git squash commit after PR completed?

In our projects, We use policy squash merge for merging and release our project when merge release branch to master branch. one of my co-worker use no fast-forward merge and put all develop's history ...
Alex's user avatar
  • 31
0 votes
1 answer
40 views

bash script that squashes commits with same name in a row

I want to create bash script that squashes commits with same name in a row. The user should be able to enter the commit number between which it will search for commit names and if it finds 2 similar ...
Haso Rosy's user avatar
2 votes
2 answers
537 views

Checkout to one of squashed commits

In a repository with squash-merge practice, can I go to the state of the repository in one of the squashed commits? For the example below, I want to find commit m1 by checking out commit r1. m1 - m2 --...
Erdem Tuna's user avatar
1 vote
0 answers
765 views

Validate commit message contains Jira Ticket Number when squash merge from GitHub webUI

When doing a squash merge, following a successful Pull Request, on github I would like to validate that the squash merge commit message contains a Jira ticket number. If it does not the squash merge ...
user19156346's user avatar
1 vote
1 answer
457 views

Avoid old commits after squashing into a branch

I have 2 branches. main and deploy. I keep committing changes to the main branch, and when it's the time to deploy, I raise a PR to deploy from main and squash all commits for a cleaner commit history ...
user3515181's user avatar
5 votes
0 answers
680 views

Visual Studio: squash intermediate commits

I can squash the last commits easily with with Visual Studio. However, if I don't select the latest commit, squash commits menu entry is grayed. Is there a solution with visual Studio to squash ...
Kiruahxh's user avatar
  • 1,760
0 votes
1 answer
312 views

How to work on a new git branch while previous branch waits for merge

First, I am sorry to ask such question because I am sure it is a straightforward issue, still I found no solution an no way to understand what I am doing wrong. Some people asked almost exactly the ...
haltux's user avatar
  • 61
3 votes
0 answers
689 views

Using an interactive rebase, how do I squash some commits, including merges?

I've read a LOT of questions on here and help documents, but I can't seem to find any solid, understandable documentation that explains addresses my needs. I work on a team that's making a major code ...
RLH's user avatar
  • 15.6k
1 vote
1 answer
2k views

Squash merging in git keeps including previously-merged branches

I'm using Github, with branches for development, live and various feature & bug branches. When I merge a feature or bugfix into development, I typically do a squash merge (usually through the GH ...
Adam Hopkinson's user avatar
0 votes
1 answer
34 views

Combine 2 commits that are NOT the last 2 commits on my branch

I have to following 4 commits: #Commit4 #Commit3 #Commit2 #Commit1 After making commits 3 and 4 I realized my first 2 commits really should be a single commit like so: #Commit4 #Commit3 #...
RayLoveless's user avatar
  • 20.8k
0 votes
1 answer
204 views

Documentation of Default Target of "git merge --squash"

Sometimes I squash a bunch of commits together. Usually my commands follow this pattern: git reset --hard HEAD~4 git merge --squash HEAD@{1} git commit Today, though, at step 2, I got distracted by ...
Kirby's user avatar
  • 15.6k
0 votes
1 answer
1k views

GitHub Pull Request: Squash before merge without fast-forward

GitHub offers three options to merge PRs: Merge pull request: No fast-forward merge. Squash and merge: Squash commits and perform fast-forward merge. Rebase and merge: Rebases all commits onto the ...
Yannic's user avatar
  • 788
0 votes
2 answers
2k views

Git + IntelliJ - how to make files appear again in commit-tab

IntelliJ has this nice features with a commit-tab in their IDE, which allows you to see all the changes in all files, and also has the revert-button and a lot of other useful functions that I like. ...
klabbaparn's user avatar
2 votes
2 answers
2k views

Git interactive rebase did not delete my other commits

I have some commits in my current branch. I want to convert those all commits into one commit and delete all those commits. So I have used the following commands git rebase -i HEAD~9 Edited all ...
smnth90's user avatar
  • 798
4 votes
1 answer
1k views

What happens to the child branch when I have squashed the commits from parent branch and merged it into master?

My branching looks like this M1 --- M2 --- M3 --- ............. --- M50 --- M51 \ \ P1 --- P2 --- P3 --- P4 \ ...
Trilokinath Modi's user avatar
0 votes
2 answers
893 views

Commit Author Not showing recent commiter name when doing Git Squash

I have a branch and few commits done by some other person. I committed few more changes to the same branch. Now i am squashing all commits to one single commit using below commands. git rebase -i HEAD~...
Deadpool_er's user avatar
7 votes
1 answer
3k views

Still compare committed difference after squash merging

I have merged a develop branch into main branch using squash merge. Let's say there are commit A, B, C merged into main from develop. The changes are successfully merged. I can see the squash commit ...
WenliL's user avatar
  • 497
0 votes
0 answers
315 views

Change default Squash And Merge commit message algorithm

I want to write CI/CD script, which will change the default generated Squash And Merge commit into the convention my team uses. Is it possible to change it in CI/CD level, can I get commit messages in ...
Tigran Yengibaryan's user avatar
3 votes
2 answers
1k views

How to squash several commits to another branch?

I will develop my app in branch dev and provide the "best so far" (a release on GitHub) on a branch public. The branch dev will have commits c964dea, 06cf8ee, 396b4a3 and 9be7fdb. I would ...
WoJ's user avatar
  • 29.2k
0 votes
0 answers
283 views

Merge commit from main branch to release

I have two main separate branch Master and release. My two PR(pull request) merged to Master branch called. featureA and featureB and deleted. Also many other feature branch merged to Master by ...
ketan's user avatar
  • 19.3k
7 votes
2 answers
2k views

What is the difference between `git rebase -i HEAD~N` and `git reset --soft HEAD~N`?

We can squash the last N commits in Git. As I understand, we can squash last N commits using git rebase -i HEAD~N or git reset --soft HEAD~N. In the answers for this question (Squash my last X commits ...
alper's user avatar
  • 3,302
0 votes
1 answer
76 views

How to squash commit to last commit? - problem with order

In the company I work for, we use Gerrit (unfortunately) and I need to flatten non-pushed commits into one comit. When I check the commit list in InteliJ, I see: ...
JanuszFrontEnd'u's user avatar

15 30 50 per page
1
2 3 4 5