[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
I have git woes, /g/ Today I accidentally merged my dev branch
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 17
Thread images: 2
File: dog-face.jpg (54 KB, 668x567) Image search: [Google]
dog-face.jpg
54 KB, 668x567
I have git woes, /g/

Today I accidentally merged my dev branch into master branch via messy hotfix acrobatics. Not content with this initial idiocy, I pushed the master branch to origin, then realised what had happened.

Is there a way to undo the merge and have the change reflected on the origin repo as well?
>>
git reset --hard?
>>
Check merge's id with "git log"
Then git revert
>>
>>51423006
revlog fuckery
>>
I've read the git book back to back and a few tutorials and I still don't fully understand it. I might dive into a random project just to learn more about git; using it for my own stupid shit just feels silly and I like I'm not learning anything.
>>
>>51423006
Git reflog, git reset, git push - f
>>
Checkout the last proper commit on master and then force push that to origin, erasing the history of your disaster. If for some reason you want to preserve your screw up in history, just revert the merge commit.
>>
>>51423948

Tried it, didn't work

>>51423999

Tried this too :(

>>51424009

Do you mean reflog?

>>51424051

Does git-reset require any flags or is the command literally as you described it?

Also does this still work if there's no current MERGE-HEAD? I'm on a different machine currently, just seeing what I can do with clones of the origin repo.

Cheers all for the advice.
>>
>>51424089

How do I check out a specific commit?
>>
File: dog.gif (25 KB, 558x495) Image search: [Google]
dog.gif
25 KB, 558x495
>>
>>51424723

Looks like Chewbacca
>>
>>51424686
git checkout SHAOFCOMMIT
>>
Poor dog 3:
>>
>>51424686
so you'll probably want to do

git checkout sha123456123

git push -f origin branch_name

but, you dumb faggot, make sure you take current master and do

git checkout -b master_copy and push that shit somewhere so that you have a back up in case you fuck more things up
>>
>>51425362
>>51425389

Great, thanks guy(s?)
>>
You should learn properly how git works.
Trying to use git just as you would use svn or mercurial is just fighting against the tool.

Believe me, learn how it works, it's not that hard and time used learning how to use your tools is not time wasted.

I learned mainly with this video :

https://www.youtube.com/watch?v=8dhZ9BXQgc4
>>
>>51426673

Yeah, I've been in the habit of just using the bits I need at any given time. I'll do this.
Thread replies: 17
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.