Git help required, again!
Page 1 of 1
paxsali
Banned



Posts: 18338

PostPosted: Sun, 5th Feb 2023 21:37    Post subject: Git help required, again!
Code:
# What happened?

# do some coding, test it, everything is O.K.!
$ git add .
$ git commit -m 'major LP re-write, improved logging'
$ git tag v1.1
$ git push

# shortly after, ... notice a minor typo, correcting it...
$ git add .
$ git commit --amend
# in vi, just type ":wq", accepting previously typed commit messages...

$ git push
To ltkrmt01:/data/repos/meta
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'ltkrmt01:/data/repos/meta'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

# WHAT??? WHY??? why can't I push anymore???

$ git log
06914d4 (HEAD -> main) major LP re-write, improved logging
2f203b0 (tag: v1.1, ltkrmt01/main) major LP re-write, improved logging
5202805 (tag: v1.0) added minor verbose outputs and documentation.
90356f1 added AIO-workflow
5366207 added zypper-repos module
86d6308 included support for Tumbleweed
640124c moved AIO deploymnet heading further up to functions
6a811a8 minor re-phrasing
81e281a big re-work
010324a removed duplicate shebang
ed3c284 snapshot
9ce6696 added netbackup firewall module for later implemantation
8df2135 fixing typo only...
887134a fixed double shebang bug and sssd.conf set to chmod 600
a45689c bugfixes from test runs...
5bbd6a6 snapshot modules
975d1f5 updated .gitignore
b400deb added update of workdir repo on ltkrmt01 function
28e719b updated org functions
0ddab89 added sub-headings


# I am at commit 06914d4 now, but I cannot push anymore.
# I think the previous "git commit --amend" did not work as I am used to it, because there was the "v1.1" tag previously?? is that the reason why it behaves like this?

# anyhow I don't know what to do now, as I really expected it to *stay* at commit 2f203b0 after the amend *without* creating a new commit (and *without* detaching it's head, obviously) and that pushing would still work.

# so how do I fix this? I assume this must be trivial, no?

# please help sad little pax!!


Crying or Very sad


"There will be no end to the troubles of humanity, until philosophers become kings, or kings become philosophers.", Plato.
"Hyperbole will destroy us all.", Matt Dillahunty.
"The hyperbole, the demonization of the other opinion and the unwillingness to even read the opposing opinion destroys the so important political discussions necessary for the well functioning of society.", Couleur
Back to top
AmpegV4




Posts: 6248

PostPosted: Sun, 5th Feb 2023 23:54    Post subject:
⁢⁢


Last edited by AmpegV4 on Mon, 23rd Feb 2026 08:55; edited 1 time in total
Back to top
paxsali
Banned



Posts: 18338

PostPosted: Mon, 6th Feb 2023 00:42    Post subject:
⁢⁢


Last edited by paxsali on Thu, 4th Jul 2024 22:59; edited 2 times in total
Back to top
paxsali
Banned



Posts: 18338

PostPosted: Mon, 6th Feb 2023 19:09    Post subject:
⁢⁢


Last edited by paxsali on Thu, 4th Jul 2024 22:59; edited 2 times in total
Back to top
Guy_Incognito




Posts: 3436

PostPosted: Mon, 6th Feb 2023 19:40    Post subject:
Well you can always do the peasant method I do because I never trusted the amend command

1) locally, git reset HEAD~ (files from previously last commit will get marked as modified), change whatever, commit locally
2) on remote, git update-ref HEAD HEAD~ (if it's bare repo) or git reset HEAD~ (if not)
3) locally, git push origin master
Back to top
AmpegV4




Posts: 6248

PostPosted: Tue, 7th Feb 2023 00:44    Post subject:
⁢⁢
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Programmers Corner
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group