How to fix my Git HEAD after inadvertent branch push?
How to fix my Git HEAD after inadvertent branch push?
Loading saved threads...
Dennis Jorgenson · External communityPost link
External question — Stack Overflow Stack Exchange
Author: Dennis Jorgenson
Original post: https://stackoverflow.com/questions/77554454
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I've been a Git user for many moons - in Windows. I used to use CLI+Tortoise Git and rarely encountered problems. I made the switch to Linux (kubuntu 23.10), install VS Code (beauty, btw), and installed the Git Graph extension (truly, wow). Then, while working in a branch, I committed my work and then something happened: it seems my repo now has two heads. I would prefer not to undo the commit in favor of a fix to correct the issue; meanwhile, work continues. The snapshot shows a bit of what my repo looks like and the lines are not connecting back to the root.
enter image description here
I was trying to commit branch changes locally (only) - but then the 'tool' pushed my changes and created another head? Don't know how to fix this, usually, I commit locally, switch to master, then merge. This is what I thought was going to occur - but the 'tool' outsmarted me.
Tried one of the rebase recommends, results below:
djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (master)
$ git push origin master
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 12 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 308.80 KiB | 34.31 MiB/s, done.
Total 5 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/djorgens2/MT4-Master.git
efa5240..bf6bcee master -> master
djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (master)
$ git rebase origin master
Current branch master is up to date.
djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (master)
$ git pull origin -r master
From https://github.com/djorgens2/MT4-Master
* branch master -> FETCH_HEAD
Already up to date.
djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (master)
$ git switch man-v5
Switched to a new branch 'man-v5'
branch 'man-v5' set up to track 'origin/man-v5'.
djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (man-v5)
$ git switch master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (master)
$
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: Dennis Jorgenson Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/questions/77554454 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I've been a Git user for many moons - in Windows. I used to use CLI+Tortoise Git and rarely encountered problems. I made the switch to Linux (kubuntu 23.10), install VS Code (beauty, btw), and installed the Git Graph extension (truly, wow). Then, while working in a branch, I committed my work and then something happened: it seems my repo now has two heads. I would prefer not to undo the commit in favor of a fix to correct the issue; meanwhile, work continues. The snapshot shows a bit of what my repo looks like and the lines are not connecting back to the root. enter image description here I was trying to commit branch changes locally (only) - but then the 'tool' pushed my changes and created another head? Don't know how to fix this, usually, I commit locally, switch to master, then merge. This is what I thought was going to occur - but the 'tool' outsmarted me. Tried one of the rebase recommends, results below: djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (master) $ git push origin master Enumerating objects: 9, done. Counting objects: 100% (9/9), done. Delta compression using up to 12 threads Compressing objects: 100% (5/5), done. Writing objects: 100% (5/5), 308.80 KiB | 34.31 MiB/s, done. Total 5 (delta 3), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (3/3), completed with 3 local objects. To https://github.com/djorgens2/MT4-Master.git efa5240..bf6bcee master -> master djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (master) $ git rebase origin master Current branch master is up to date. djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (master) $ git pull origin -r master From https://github.com/djorgens2/MT4-Master * branch master -> FETCH_HEAD Already up to date. djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (master) $ git switch man-v5 Switched to a new branch 'man-v5' branch 'man-v5' set up to track 'origin/man-v5'. djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (man-v5) $ git switch master Switched to branch 'master' Your branch is up to date with 'origin/master'. djorg@DESKTOP-25485G2 MINGW64 ~/AppData/Roaming/MetaQuotes/Terminal/6BCF14A3917E5BC71FD48812B8ED0586/MQL4 (master) $
Checking account access…