2,245 questions
2
votes
1
answer
90
views
Git rebase file content messed up
Environment:
Local machine: Linux 16.1
Repository member: Visual Studio 2022 (Win11)
Today I merged a team member’s PR into master. This member modified file B. After the PR, the master branch’s graph ...
0
votes
1
answer
100
views
Add commit to an already-merged branch
This is my project's log:
nubarke@linux0:~/CLionProjects/untitled$ git log --graph --all --oneline
* 3ee3af6 (HEAD -> master) Rename project to Hard Disk Drive Stress Test
* 36f6c14 Off-by-one ...
-1
votes
2
answers
128
views
Git fixup after a merge with upsteam
Scenario:
work... work... work... git commit -m "Step1"
work... work... work... git commit -m "Step2"
work... work... work... git commit -m "Step3"
git pull # merge a ...
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 ...
3
votes
1
answer
111
views
When removing a file from history, what makes it still left in tree?
I have a private file that leaks into the repo, and I want to delete it. Here are the commits I suppose that it is first added:
git log --follow --diff-filter=A --find-renames=40% --pretty=reference --...
0
votes
1
answer
73
views
Rebasing on top of master: what if same commit exists already in master's history?
During development I noticed a bug in someone else's code. It was necessary for me to fix the bug to continue testing my feature, so I created a fixing commit on my branch, and then a new branch from ...
-2
votes
2
answers
61
views
How can I rebase a Git branch as though a file was never changed? [duplicate]
Let's say I have the following text file:
fruits.txt
apple
mango
pear
That's the state of the file as-is at the HEAD. The file was last altered 2 commits ago. Before that commit the file read:
...
-1
votes
1
answer
71
views
Keep branch structure during git rebase
Let's say I have the following tree:
A -- B -- C -- D -- E main
\
F -- G -- H featureA
\
I featureB
I'm working off ...
1
vote
1
answer
47
views
How to rebase a git branch that contains a merge commit *and* corresponding, previous branch-point
I am trying to interactively rebase commits from the branch tmp/20241220-rebase-source onto tmp/20241220-rebase-target.
The commits to rebase include a branching point and corresponding merge-commit (...
1
vote
0
answers
42
views
Rebase and Deployment in GH Actions
I have a deployment.yml workflow in my repository that looks like this:
name: Run deploy
on:
workflow_dispatch:
push:
branches:
- main
- staging
- dev
Nothing fancy, has ...
0
votes
3
answers
85
views
git merge changes after previous merge
I have worked on a branch, and successfully merged my changes. After that I did another commit and want to merge it as well. However when I create pull request, it offers to merge the whole branch and ...
1
vote
2
answers
139
views
How to get back my old branch after a failed git rebase [closed]
I have the following situation: I rebased the feature branch my-branch on master using
git rebase master
from my-branch.
However I'm not happy with the result (AFTER), so what I want is to get back ...
8
votes
1
answer
253
views
Git squash commits in middle of branch with child branches after that
I have the following repo:
A--B--C--D--E--F--G--H--I--J
\
K--L--M
main -> J
DEV -> M
I want to squash the commits between B and E so the repo looks like ...
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 ...
0
votes
2
answers
115
views
After merge to master, rebase with master giving conflicts for all files merged to master
Case
A new branch created for given requirement
Adding changes as per requirement in the branch and
Below commands executed every time we commit
git add .
git commit -m "comment" (...
0
votes
3
answers
132
views
git rebase --rebase-merges not preserving merge order
I have a repo that looks like this...
-+----*----*------*------------------------- Main
\------------+---------+------+-- Dev
\-*--*--*--/-*--*--*-/-*--*-/ Feature1
That's my best attempt at ...
0
votes
0
answers
53
views
Can I drop and squash the same commit on two different branches with the same set of rebasing instructions?
I have a git status along the following lines
main-branch
* somehash001 (same as below)
* somehash002
...
feature-branch
* somehash003
* somehash001 (same as above)
...
I would like to rebase ...
0
votes
0
answers
146
views
git rebase is stuck in "Enumerating objects: 1, done" loop
I have a feature branch feature and a develop branch. In the feature branch, I ran git rebase develop, but I got stuck in a very strange loop:
remote: Enumerating objects: 1, done.
remote: Counting ...
0
votes
1
answer
61
views
Orphaned branches after rebase not being garbage collected [duplicate]
Recently a few times after rebasing I've seen what I assume are temporary commits and branches that get creating during the rebase. Presumably these should get garbage collected, but they haven't ...
1
vote
1
answer
72
views
How to reorder commits to make a squash in git?
When doing interactive rebase for making squash and merge some commits into one I realized that when commits are not correlative this can not be done properly, this is an example suppossing we have 5 ...
1
vote
0
answers
70
views
How to rebase a branch while keeping already merged commits?
We have the usual workflow of main, dev, and changes done in topic branches.
Sometimes we want to deploy a quick-fix to production but without merging other dev changes. We might do a PR and merge ...
0
votes
2
answers
78
views
How can you rebase a branch that is tracked remotely?
We've got a development branch, dev1. Starting from that, I create a feature branch, f1 and push to our git server:
git checkout -b f1
git push -u origin f1
I make some changes, commit them and push ...
0
votes
1
answer
42
views
How rebasing develop after merge on master?
On my project, when devs ask for merge of feature branches on develop, the source branch is merged, and afterwards deleted, because in the Merge Requests settings, we checked Enable "Delete ...
2
votes
2
answers
175
views
What are the git commands to rebase a child-branch whose parent branch has been rebased?
This has happened multiple times where we have a devel branch on which a large feature (feature/one branch) is being worked by multiple people. Each developer branches off of feature/one and performs ...
0
votes
0
answers
144
views
Maintaining stacked PRs with constant amending
My employer requires that all pull requests contain a single commit. So I often have several inflight PRs that depend on each other. Given master -> branch A -> branch B, when I need to update A,...
1
vote
2
answers
2k
views
How to merge master to feature-branch only using Gitlab GUI/Web IDE?
Maybe an odd situation, but I have fiddled with this myself and searched several forums without any luck. Is this even possible without setting up a local environment and cloning the repo?
For some ...
1
vote
1
answer
68
views
Problems when rebasing because of an untracked file
I want to rebase a branch into the main branch so I do
git checkout MyAwesomeBranch
git rebase main
The problem is that I get
Using index info to reconstruct a base tree...
.git/rebase-apply/patch:68:...
0
votes
0
answers
43
views
Is there any reason why some would want to rebase a branch and then merge --no-ff to force a merge commit?
From what I understand, rebasing essentially moves the base of your branch to a more recent (the most recent?) commit to make it seem like you branched off later than you actually did.
This makes it ...
1
vote
1
answer
79
views
Confused about Git merge with multiple branches. How can I merge the changes made in a branch created from an existing Pull Request branch? [duplicate]
I had a project where I had to make some changes.
I created a first Pull Request:
git checkout -b v1
This PR is waiting to be reviewed and approved by my team lead.
Meanwhile, I had to open a second ...
-1
votes
1
answer
75
views
Losing files and changes once doing rebase with GIT
My branch is way too behind the main development branch and I want to add these changes to my feature branch
I have rebased my feature branch to main development and I can only see other team changes, ...
-1
votes
1
answer
70
views
CONFLICT after rebase when file deleted in remote branch (master)
I have a branch that needs to be rebased onto master since there is a change in master. Basically, one of the header files has been deleted and some of its contents moved to another unit (split ...
1
vote
1
answer
348
views
Git Rebase Hell
I have a repo. It is a little bit chaotic...
I can let it be as is and just go on using proper flow from now on, but...
Can I at least fix some commit messages and keep old branches for history?)
It ...
0
votes
2
answers
145
views
Pull and rebase from master in same time
I want to optimize the following process:
branch A> checkout master
master > git pull
master > checkout branch A
branch A> git rebase master
Is it possible to do these commands in one ...
2
votes
1
answer
412
views
Git equivalent to Mercurial's 'hg evolve'
Let's say I have multiple commits, like this:
---A---B---C---D
\
E---F---G
\
H
Now let's say I amend a change to B, creating commit B'
...
1
vote
1
answer
96
views
What is the git issue that causes a bunch of commits already on master to be pushed to a pull request from a feature branch
I often see this in pull requests, where someone accidentally pushes up a bunch of rebased commits into their PR, and then in the commits tab, there's a long list of all the existing commits that are ...
0
votes
0
answers
35
views
git - clean pr/feature branch from dev/feature branch
I am developing some code in a dev/feature brach. My commit history has been messy (merges from main, files that didn't need to commit, lines that I didn't need to modify).
Now I want to do a PR with ...
2
votes
1
answer
63
views
Proper merging of chained feature branches
Situation
I am working on features that span across multiple branches.
I have a branch issue-1 that is waiting for merge with squash commits.
I checked out new branch from it, issue-2 to work on it. (...
1
vote
1
answer
91
views
How to make a git branch the descendant of an other without changing its content?
I have two branches, 2 and 4:
2c <- top of branch 2
|
2b
|
2a <- root branch 2
and
4c <- top of branch 4
|
4b
|
4a <- root branch 4
The ...
0
votes
0
answers
40
views
Conflicts when merging after rebasing in a working branch
I have a feature branch derived from master which is some months old now. I want the latest commits from master in my feature branch so I am rebasing.
However, I am doing this in a new working branch, ...
0
votes
0
answers
39
views
git rebase does not merge changes automatically
I have to rebase my topic branch from master.
There are some file with no conflicts; the rebase process, as I understood, should automatically merge changes without conflicts.
$ git checkout topic
$ ...
-2
votes
1
answer
121
views
Keep handled conflicts when rebasing a repository including complete non-linear history
A variation of a question that has been asked multiple times but I haven't been able to determine a fitting answers that covers my case.
In short I want to rebase a repository without specific commits ...
0
votes
2
answers
107
views
How to rebase a branch onto another branch than the upstream branch?
While developing a feat branch based on the develop branch, the develop branch has been ‘frozen’, that is it has been merged into the staging branch. Now I would like to rebase feat onto staging ...
0
votes
2
answers
47
views
Rebase over some branch with ignoring previusly dropped commit(s)
I have two branches A and B, the difference between those branches that B has some dropped commits from A (other one commits are identical).
When I have make some new commits in branch A I want merge ...
0
votes
2
answers
2k
views
git rebase --onto works with tags?
After some thinking I think I have a similar case of rebase as the one in the documentation although with other branch names.
Here the docs say to apply
git rebase --onto master next topic
to get
...
-1
votes
1
answer
79
views
git: merging a branch that's already been merged by mistake
Branching strategy and some context:
My team has a few sub-teams, each working on a separate project with its dedicated branch.
The master branch has the common functionality and houses a major ...
0
votes
2
answers
101
views
How to fix huge amount of commits after rebase
I had a fairly old branch and I tried to rebase it to master. I think I messed up really bad, can someone help me on how to fix it? Here is what I did:
I used git rebase origin/master. VSCode showed ...
-1
votes
1
answer
78
views
Squash old commits
I am trying to do a release with Nx. During the release process, it get an error about an unknown revision in my commit history.
This revision dates back to the initial setup of my repository.
I'm ...
0
votes
0
answers
28
views
git rebase of three already merged branches into one?
I have these three branches that looks something like this:
A1--A2----A3--...--An----AB1--AB2--..--ABn--ABC
\ \ / /
\ C1-------------+------------------/
...
15
votes
1
answer
490
views
Make `git rebase -i` present and apply commits bottom to top
Git shows commits in the interactive-rebase todo list (produced by git rebase -i) in the opposite of the usual order: the most ancestral commit (typically, the oldest commit) is shown first, not last.
...
0
votes
1
answer
47
views
Changed and Renamed directory on local GIT branch. Now I want original directory PLUS the changed one
In a new local branch, I made a bunch of code changes in a directory and renamed that directory locally.
The remote branch remains untouched -- I have not merged anything. My new directory does not ...