Skip to main content

All Questions

Tagged with
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
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 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
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
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
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
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
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
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
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
1 vote
1 answer
124 views

Get rid of several bad commits

I have repo where I don't track .gitignore, someone committed node_modules folder and later we decided to untrack it. Now same person(new to git) committed '.gitignore' for few commits before ...
chadedgar's user avatar
  • 121
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

15 30 50 per page