My Github Faux Pas: Don't do what I did

If it's not ZDoom, it goes here.
Post Reply
User avatar
Rachael
Posts: 13958
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

My Github Faux Pas: Don't do what I did

Post by Rachael »

So - Major Cooke opened up a pull request simultaneously to ZDoom and QZDoom. I figured being the kind person I am, I'd fix the one merge conflict it had in QZDoom so that it would merge smoothly when I decided to merge it later on.

I did this from Github. Successfully resolved the conflict - and committed it.

And then ended up committing the entire QZDoom repository into his branch, messing up his ZDoom pull request. >_> <_<

Don't do what I did, folks! Make sure you Github smarter than I did. :)
User avatar
Major Cooke
Posts: 8212
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: My Github Faux Pas: Don't do what I did

Post by Major Cooke »

Thankfully fixing it was as simple as right clicking on my latest commit, branching it, pushing it, and dumping the old one and replacing all the links. :P

I dunno how the hell to roll back shit once that happens so best do it a clean one.

Don't get mad! Get glad!
User avatar
Rachael
Posts: 13958
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: My Github Faux Pas: Don't do what I did

Post by Rachael »

If you haven't pulled the change yet, all you have to do is push it again, with the "force" option checked.

If however, you pulled it, then right click on the folder, open TortoiseGit and then click "View Log" - right click the target commit, and then click "Reset 'branchname' to this commit" - it will ask you if you want to do a hard reset (destroying local changes) or a soft reset (allowing another commit with the current changes).

Then you simply push the branch again, forcing it.
User avatar
Major Cooke
Posts: 8212
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: My Github Faux Pas: Don't do what I did

Post by Major Cooke »

Doesn't work like that I'm afraid. It had already queued up 2288 things to pull so it was pushed directly into my git.

No matter what I try, it denied push after push. The only course of action in this situation was to branch and delete the old one. I didn't even pull it or anything either.
User avatar
Rachael
Posts: 13958
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: My Github Faux Pas: Don't do what I did

Post by Rachael »

That's where this little checkbox comes in handy. :twisted:

This little checkbox is also known as "reverse time." (It's not a good idea to use it on collaborated branches, because someone will pull the changes you are trying to reverse and push them right back)
gitforce.png
User avatar
Major Cooke
Posts: 8212
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: My Github Faux Pas: Don't do what I did

Post by Major Cooke »

Alas, you're using gittortoise. Lucky you, you seem to have a good fairing with it like SourceTree has a good reputation with me.

Sadly gittortoise has a bad reputation with me. (Spare me the attempts, please and thank you, of putting me on it.)

At the end of the day, let's just say...
DBThanatos wrote:Shit happens, but I'd love it if it didn't.
User avatar
Rachael
Posts: 13958
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: My Github Faux Pas: Don't do what I did

Post by Rachael »

I wasn't going to try and pressure you to change. I didn't know you had used something different in the first place. In that case, I would've just given you command-line commands, since the command line is the same in all variants of Git.
User avatar
Major Cooke
Posts: 8212
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: My Github Faux Pas: Don't do what I did

Post by Major Cooke »

dpJudas just did it too. :P

Do tell what the command line things are.
dpJudas
 
 
Posts: 3172
Joined: Sat May 28, 2016 1:01 pm

Re: My Github Faux Pas: Don't do what I did

Post by dpJudas »

I blame github for creating such a dangerous feature. :P
kevans91
Posts: 72
Joined: Tue Sep 16, 2014 11:25 am

Re: My Github Faux Pas: Don't do what I did

Post by kevans91 »

Major Cooke wrote:dpJudas just did it too. :P

Do tell what the command line things are.
Can probably be fixed with something along the lines of:

Code: Select all

git checkout $yourcommit
git checkout -b known_good
git push -f origin $remote_branch
Where $remote_branch is the one you're wanting to overwrite. It should warn you about this being bad, but it should work.
User avatar
Rachael
Posts: 13958
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: My Github Faux Pas: Don't do what I did

Post by Rachael »

If you haven't pulled the changes, simply do

Code: Select all

git push -f https://your.repo/name/here your-remote-branch-name
If you have pulled, do

Code: Select all

git reset --hard <good-commit-hash>
git push -f f https://your.repo/name/here your-remote-branch-name
Klofkac
Posts: 44
Joined: Sat Feb 06, 2010 4:02 pm

Re: My Github Faux Pas: Don't do what I did

Post by Klofkac »

If you pulled the change, can't you still go back through a git reflog and force push your code back to the "correct" state?

Alas, what you learn about git when you play too much with git rebase and git filter-branch... :oops:
User avatar
Rachael
Posts: 13958
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: My Github Faux Pas: Don't do what I did

Post by Rachael »

Yeah, you can. That's what reset --hard does.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: My Github Faux Pas: Don't do what I did

Post by NeuralStunner »

Code: Select all

git commit atrocity
:P
User avatar
Big C
Posts: 2839
Joined: Tue Oct 19, 2010 3:24 pm

Re: My Github Faux Pas: Don't do what I did

Post by Big C »

Code: Select all

git gud
:mrgreen:
Post Reply

Return to “Off-Topic”