1,774 questions
1 vote
4 answers
79 views
git rebase conflict take all changes from head on single file
If I have merge conflicts, how can I take all changes from HEAD for a single file? Not for the whole rebase, but for a single file? Is this possible, or do I have to manually change it?
3 votes
1 answer
126 views
How to keep git notes through a rewrite (rebase/rename/amend)?
I have added some notes to commits using git notes add <hash> -m potato But when I rebase or amend the commits, the note is not copied over to the new rewritten commit. According to the docs ...
0 votes
1 answer
94 views
Is there a way to run a command if a rebase step fails with a merge conflict?
While doing lots of branch-management via rebasing I have a number of common situations that cause merge conflicts to occur for which I have developed helper scripts that resolve the situation. When ...
4 votes
3 answers
95 views
Looking for a clean way to reword a few commits from before multiple merges were done without having to re-resolve conflicts
Note: I have already looked at the following answers and they don't seem to apply or work in the way I expect them to work: Reword one commit prior to merge Squashing old git commits that were before ...
2 votes
1 answer
100 views
Why does "git rebase" continue to conflict after choosing the "--ours" version of a file the first time?
I pulled from origin main, and I'm having issues handling conflicts on my branch. I did the following git checkout test (name of my branch) git pull origin main It tells me I have conflicts and is ...
0 votes
2 answers
83 views
How to rebase/? a fork of a FOSS project so when I submit a PR my multiple commits/syncs show as 1 commit? [closed]
UPDATE: The 1st question below has been resolved. My remaining question is what is the best way to rebase a fork before I submit a PR to a FOSS project so my changes (of multiple commits and sync's) ...
-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. ...
0 votes
1 answer
49 views
`git rebase --interactive` always use rebase-then-squash workflow and introduce many conflict resolution, how to switch to squash-then-rebase?
Here is a typical example of executing git rebase --interactive --autosquash: git rebase --interactive --update-refs origin/master Rebasing (1/102) Rebasing (2/102) error: could not apply eff00df3... ...
0 votes
2 answers
106 views
Safest way to resolve push conflicts and messy commit history after rebasing local branch with updated main?
I recently rebased my local feature branch onto the latest main branch to get up-to-date. Now, my commit history looks all weird—some commits seem duplicated or out of order, and when I try to push, I’...
6 votes
1 answer
150 views
Git rebase removes an empty conflict resolution despite options `--empty=keep` and `--keep-empty`
I have a script that does a git rebase with the flags --empty=keep and --keep-empty. It's important that no commit is dropped because the script later relies on relative refs (like HEAD~3) and on the ...
0 votes
1 answer
126 views
What does `git diff` actually compare during a rebase conflict?
I have recently learned that git diff --cached shows how the new commit during an interactive rebase conflict after resolving the conflict looks. What does git diff compare during resolving a git ...
1 vote
1 answer
54 views
Git-rebase fails multiple times each rebase, claiming deleted files will be overwritten, but the working tree is clean and `--continue` works. Why?
I apologize, the situation I am about to lay out below is probably very confusing, because I am very confused myself. As this is related to work, I cannot provide the actual repository. Summary of the ...
1 vote
3 answers
105 views
How to remove other branch commits?
I was reading through code when I found an issue, and had forgotten to pull the main branch before opening my branch to make my fix, and commit. I noticed when opening the PR that there were latent ...
3 votes
3 answers
147 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 ...
-2 votes
2 answers
99 views
Why is git autosquash not working as expected? [closed]
Update My company adds a prefix to the commit history which i had gotten so used to, I didn't see it but of course git would, and that was causing the issue. Removing that prefix fixed my issue. ...