Questions tagged [git-rebase]
With the git-rebase command, you can take the changes from one branch and replay them on top of another branch.
1,557
questions
0
votes
1
answer
31
views
What to enter for commit when trying to perform a git rebase?
A week ago, I accidentally changed my email settings to public on GitHub. I then made about 20 commits that I discovered weren't showing up on my contribution chart. I have changed my email back to ...
1
vote
2
answers
55
views
Git rebase vs merge after rebase master on feature branch
I'm learning about rebase and saw a workflow of doing a rebase on a feature branch and then merging it into master (as an example):
git checkout feature
git rebase master
git checkout master
git merge ...
2
votes
2
answers
23
views
Git rebase - re-create result of a command (yarn.lock file, etc)
Getting this error:
Executing: git reset --soft HEAD~ && git restore --staged yarn.lock && git restore yarn.lock && yarn install && git add yarn.lock && git ...
-1
votes
0
answers
11
views
why there is a issue coming while rebasing to develop branch? [duplicate]
how can i rebase my develop branch?
first i have create a commit and then i used git fetch origin develop.
till git fetch origin develop everything works. it shows me
branch develop ->...
2
votes
1
answer
56
views
In pre-commit hook, find hash of the parent of the commit that's being created
I have some tests in my pre-commit hook which require the hash of the previous commit to work.
By previous commit I mean the one that will become the parent of the commit that's being created right ...
1
vote
3
answers
30
views
Can you rebase while rebasing?
Let's say I am doing a large rebase (yes, it's better to do one history change at a time, but, I'm an expert here).
I breakup a large commit, and have a few snippets to squash into older commits (I ...
0
votes
0
answers
33
views
After git_rebase_finish (), the HEAD pointer separately from the master branch
I am making an analogue of Git Pull --rebase using the Libgit2 library, the code is made without errors, but only I have Head in front of Master.
I cannot understand what the problem is.
Here is my ...
1
vote
2
answers
47
views
Is it safe to use git rebase on a shared feature branch?
A colleague of mine created a feature branch feature/dotnet6 from our main branch developing to work on migrating some of our .NET Framework projects to .NET 6.
His feature branch has been around for ...
0
votes
1
answer
30
views
How to update the cherry picked commit on gerrit?
I made a commit A to a branch. It's not merged yet. My friend cherry picked my commit and made a new commit B. Now they form a relation chain right? So, If I amend my commit A, What is the best way to ...
0
votes
1
answer
23
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 ...
0
votes
1
answer
25
views
Merging a rebased branch into the un-rebased version of it
I have a branch FEATURE that was split from MAIN about a year ago, and has some extra features.
I have created a new branch MY-FEATURE from the FEATURE branch.
I have rebased MY-FEATURE branch to the ...
0
votes
0
answers
84
views
error: update_ref failed for ref <branch> : cannot lock ref <branch> is at but expected
git rebase --continue giving the following error
error: update_ref failed for ref 'refs/heads/replicating/realtimeAPIs': cannot lock ref 'refs/heads/replicating/realtimeAPIs': is at ...
1
vote
2
answers
88
views
rewrite history to undo all changes to a file on current branch in git
Suppose I have a feature branch that modifies half a dozen files. Most of the commits on that branch involve file.py. I eventually realize that there's a potentially better way to implement this ...
-1
votes
2
answers
141
views
How to rebase only specific commits?
When I do git rebase -i <commit> it pulls up a list of commits starting from that commit and I have to choose which commits I want to edit by changing pick to e. But when I change pick to e and ...
1
vote
0
answers
16
views
git rebase : how git restores hashes of copied commits [duplicate]
I have this scenario.
I had a develop branch which goes like this:
c1->c2->c3-----develop
then I checkout my feature branch from develop and made some commits while other people continued to ...
-1
votes
2
answers
135
views
Git rebase vs checkout
It's been a while that whenever I want to review new changes in a branch (remote/local) I am doing a checkout to that branch, but recently I came across rebase command which seems to be created for ...
-1
votes
2
answers
73
views
Git workflow for feature branches
I created a remote feature branch which has multiple changes.
I updated remote branch with master multiple times to keep it up to date. I did merge instead of rebase to avoid force pushing remote ...
1
vote
1
answer
55
views
Git Workflow - Correct early errors
Let's say I have a branch Master With the following commits:
M1->M2
Then from M2 a branch Feature is created and developed as:
M2->F1->F2->F3->F4
Then a merge request is created from ...
3
votes
1
answer
109
views
git rebase really old commit
I am trying to undo a really old commit that has already been pushed to the remote.
I looked around and thought that git rebase was probably the best solution.
so I ran the code:
git rebase -i <...
0
votes
1
answer
41
views
Git Rebase deleted current files
I have been struggling with git rebase and not sure how it works. So, what I did is following steps:
git checkout main
git pull origin main
git checkout my-branch
git rebase origin/main
Then I got ...
0
votes
0
answers
50
views
Is there any better implementation strategy to avoid conflict while using git rebase or git merge?
Currently I am working on a project with following strategy for Git:
We have a master branch (production)
We have a staging branch (staging server)
Whenever we need a new feature or fix, we create ...
0
votes
1
answer
24
views
What happens to the commits that are not shared/mutual among multiple branches and you rebase one of the branch?
My git structure looks like this
M1 -- M2 -- M3 -- ..................... -- M70
\ /
(branch P) P1 -- P2 -- P3 -- P4 -- P5 /(branch rebase on ...
1
vote
1
answer
167
views
how to rebase when prettier formatting was applied to whole project
Someone merged in prettier formatting changes across the whole codebase, and I am now trying to rebase against latest master/main/develop branch. How can I rebase most efficiently?
0
votes
0
answers
59
views
Rebasing QA branch off of main instead of develop
Initially in my workflow, I had the following branch structure (develop off of main, feature branches off of develop):
main ---\
\-- develop --\
\-- feature --
Later ...
0
votes
0
answers
44
views
Improve git's suggestions for merge conflicts of adjacent hunks?
Related to my previous question Git merge conflict upon rebasing adjacent deletion and insertion?
By default, git's merge algorithm can give dangerous/unhelpful suggestions.
For instance, I have ...
0
votes
0
answers
25
views
Rebase local commits on remote subtree update
I'm trying to build a monorepo that has subtrees to other projects I'm using. In these subtrees I want to make some customizations to fit my monorepo project.
When changes occur on the remote (...
2
votes
2
answers
88
views
Is there sort of a reverse cherry-pick in Git?
tl;dr: How can I keep the current last couple of commits on a branch, and replace the history before that with that of another branch?
I have a branch where I want to keep the existing last 3 commits ...
0
votes
1
answer
212
views
GIt rebase not working. Waiting for editor to close a file
I installed chocolatey and was looking forward to using it as a rebase tool because the rebase tool I get with vs code was glitchy. It wasn't working properly. When I tried using git rebase -i HEAD~2, ...
1
vote
1
answer
154
views
Git rebase without having most recent changes in workspace
Today I was struggling with the following scenario (note: all branches were pushed into the remote repository):
Branch X was forked from branch Z and have A commits ahead. I did git pull and had the ...
0
votes
1
answer
48
views
git rebase and keep branches of rebased branch
When I have a git graph that lookslike this:
A - B - C
\
E - F - G - H
\ /
I - J
is it possible and if yes what commands do I need to use to come to a ...
0
votes
0
answers
153
views
GitLab issue: No conflicts in the commit but still get "Merge blocked: To merge this request, first rebase locally"
We always get this message in Gitlab: "Merge blocked: fast-forward merge is not possible. To merge this request, first rebase locally" even when we do not have any conflicts in our commits.
...
0
votes
2
answers
35
views
Change what remote branch a local is associated with?
I am maintaining a branch in a git repo (the local/remote in the diagram). The code I worked on in the local version of the branch actually belongs in the other branch (Branch 2 in the diagram).
...
0
votes
1
answer
126
views
How can I safely git rebase commit history in master
My new team has not been using git in the most efficient way and my lead asked me to clean up the repo. They all have been working off of master - not creating branches. There are many small commits ...
0
votes
1
answer
53
views
git rebase: merge notes into commit message
Given a commit with notes attached, can I take the message in the note and merge it into the commit's message when I do a rebase?
The background of this question is that I have a large repository ...
0
votes
0
answers
38
views
GitHub shows incorrect commit dates with force push after git rebase [duplicate]
On a new branch, I amended an older commit message by using the reword option in a git rebase. But, after doing a force push with git push -f, GitHub shows different commit history dates with all the ...
3
votes
1
answer
53
views
Git: How to skip to the end of a rebase and keep all changes so far?
I'm in the middle of an interactive rebase and I've already amended several commits.
I have several remaining commits that I've marked to edit, but I've decided that I don't want to edit them anymore.
...
0
votes
0
answers
33
views
Git rebase changes from parent branch not coming
I have 2 branches X and Y. X is parent of Y.
X have some feature-branches rebased into it for e.g X-F1, X-F2..
Y also have some feature-branches rebased into it.for e.g Y-F1, Y-F2..
All the feature-...
0
votes
1
answer
30
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
#...
0
votes
2
answers
41
views
Git merge between master branch and outdated but with news lines feature branch, merge result wrong
Main branch:
-test.txt
-A
-B
-C
-D
Feature branch: branch out from main, and adds -E in a new line
In the meantime, line -C is deleted on main branch.
Now if I want to do a pull request, first i ...
0
votes
1
answer
187
views
How merge with master without conflict after rebase in feature branch?
I plan on creating a feature branch, and in addition to the new commits in the feature branch, I might also make file edits to an older commit in the feature branch through git rebase. Then I plan on ...
0
votes
2
answers
329
views
finish git rebase operation after conflict
For my job I need to do a git rebase of my feature branch onto the development branch.
These are my commands thus far to prepare the rebase:
git checkout feature-branch
git rebase development
# ...
1
vote
2
answers
461
views
Git rebase a branch on another after parent branch is merged to master
If I have branch_1 forked out of master with let's say 2 commits.
Next, I made branch_2 forked out of branch_1.
On branch_2 I have made changes which are not in the area branch_1. I of course have ...
0
votes
0
answers
56
views
git - rebase a pull request without affecting merge commit history
I have a feature branch called branch_1. I made some changes to this branch and then created a pull request. Upon getting feedback I made the changes and updated the PR.
I need to rebase branch_1 with ...
1
vote
1
answer
59
views
Rebase or merge a branch onto another feature branch merged in master
I have a feature branching scenario that I'm working on, and I'm a little unsure which way to go as the "best solution."
a -- b -- c <-- Master
\
...
0
votes
1
answer
67
views
how to merge branch into master on the created commit
I have this senario that i created a branch A from master where the master head was on 1234 commit id
and now some developers pushed more branchs and commits into master and now the master head is on ...
1
vote
0
answers
65
views
Git rebase flagging ALL changes?
We're trying to maintain a set of configuration files in a git repo.
From time to time, we make a release of the latest configuration to a target system.
We then make further changes to the repo
While ...
0
votes
1
answer
54
views
Peepcode-git.pdf: Best strategy to keep a long standing feature branch in sync with main branch with rebase
In the following documentation peepcode-git.pdf located at https://github.com/pluralsight/git-internals-pdf/releases, page 39 notes different use cases for rebase. Particularly this quote:
"If ...
-1
votes
1
answer
424
views
git rebase --continue command not getting work
Hi Everyone i trying to rebase local branch from origin master
steps
git pull origin master
git checkout driver_management
git rebase master
git add .
git rebase --continue
while exicute git ...
-2
votes
1
answer
129
views
How to merge two commits from different branch?
let say i have a commit 1 which is already present in branch A. I have a new commit 2 in branch B, i want to move this commit 2 to branch A and merge with commit 1.
2
votes
1
answer
3k
views
Git Merge Fast-Forward vs Git Rebase
What is the difference between a fast-forwarded git merge and a git rebase? Don't both accomplish keeping history linear and no merge commits? If so, why would one use one over the other? If not, ...