243 questions
-2
votes
1
answer
135
views
I only edit one commit in an interactive rebase and pick the rest. What makes the result squashing them into one?
My history is linear:
... — B — C
I make an interactive rebase to B~1 and set to edit B, pick C. All I do with B is to add a file to the gitignore, rm --cache -r . and commit --amend --no-edit it. ...
-1
votes
2
answers
138
views
Partially squash commits
I have a branch in GitLab with 18 commits, with a lot of back and forth trying the right way to escape something.
Ideally, the branch should have three commits, changing three different parts of the ...
3
votes
3
answers
150
views
Can squash commits be done in both directions of the timestamp?
Say there is a squash of 3 commits into a single commit like so:
pick abc Jan 1 stuff
squash def Jan 2 stuff
squash ghi Jan 3 stuff
pick jkl Jan 4 stuff
pick mno Jan 5 stuff
In the above, my ...
1
vote
1
answer
99
views
How do I include the list of changed files FOR EACH COMMIT when squashing commits?
When making commits, I tend to say things like "Removed xyz property" in my commit message, where the commit message kind of depends on you seeing the file list in order to see which files ...
0
votes
4
answers
113
views
Squash a single conflict fixing incorrect merge conflict resolution into merge commit
This is a scenario I've run into multiple times: suppose you have a feature branch, and you then need to merge in the develop branch and resolve conflicts prior to your PR being merged. You merge ...
-2
votes
3
answers
176
views
How to see if remote branch was squashed [closed]
I've been pair programming with a colleague, I know he squashed all the commits on our branch (that's how we do in our team, before merging). However, I need to modify the branch.
This context is ...
-4
votes
1
answer
142
views
Retain only initial & latest commit
I need to retain only the initial & latest commit in both the master and release branches of my Gerrit repository.
So how do i remove all previous commits and keep only the initial(repository ...
-3
votes
5
answers
259
views
Deleting all but the last five commits to reduce size of repository [duplicate]
I want to reduce the size of my repository by removing all commits older than the 5th commit ago.
This question is different than other questions because I am looking for answers only for that very ...
0
votes
1
answer
118
views
Best way to merge after base branch was squashed into main branch
I have a minor git issue that keeps coming up. I have a feature that's in a PR, and then another feature that is dependent on it.The base for the second feature is squash merged. The second feature ...
2
votes
2
answers
94
views
How to squash two specific commits in non interactive way?
I have two non-sequential commit abc123 and def456.
I want to squash them together in a way that fulfil the following requirements,
their original commit messages remain reusable.
done in a non-...
1
vote
1
answer
95
views
How to squash every merge commit on a branch (like `git rebase --squash-merges` instead of `--rebase-merges`)?
I'm trying to reconcile a very large feature branch with hundreds of commits that multiple teams and agencies worked on for a long time period. Unfortunately due to corporate policy issues it wasn't ...
-1
votes
1
answer
75
views
Squash and merge vs Regular merge
If I am merging a feature branch feature into the main branch, what difference does it make (with respect to the main branch's history) whether I do a squash and merge or a simple merge?
Before merge:
...
0
votes
0
answers
177
views
Repeatedly getting very large diffs on github pull requests
I'm working on a project using GitHub to manage our workflow. We've got main and we cut a new release/24XX.XX branch for each release. When the release goes out the door we squash merge it back to ...
0
votes
1
answer
76
views
Git squash old commits
I have a git log like this
* cb0bfd5 (HEAD -> feat/nuxt, fork/feat/nuxt) Split into icons
* f2d2410 fix: buttons spaces & move layouts to components (#3)
* 881d4ab Split into Components, ...
-1
votes
2
answers
154
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 ...
0
votes
1
answer
142
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 ...
2
votes
4
answers
2k
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 (...
1
vote
0
answers
69
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 ...
0
votes
1
answer
63
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 ...
1
vote
0
answers
73
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
...
-1
votes
2
answers
801
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 ...
1
vote
1
answer
76
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 ...
0
votes
2
answers
390
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 ...
0
votes
1
answer
53
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
...
0
votes
2
answers
980
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" ...
3
votes
2
answers
131
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 ...
2
votes
1
answer
243
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 ...
0
votes
1
answer
265
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 ...
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 ...
2
votes
3
answers
206
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 ...
2
votes
1
answer
2k
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 ...
0
votes
1
answer
881
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
...
0
votes
0
answers
54
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={...
0
votes
0
answers
46
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 ...
1
vote
0
answers
14
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 - ...
1
vote
1
answer
765
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 ...
0
votes
1
answer
92
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 ...
1
vote
3
answers
313
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 ...
0
votes
1
answer
442
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 ...
0
votes
1
answer
103
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 ...
10
votes
1
answer
2k
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 ...
0
votes
1
answer
160
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 ...
0
votes
1
answer
57
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 ...
2
votes
2
answers
705
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 --...
1
vote
0
answers
914
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 ...
2
votes
1
answer
582
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 ...
6
votes
0
answers
2k
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 ...
0
votes
1
answer
347
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 ...
3
votes
0
answers
747
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 ...
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 ...