[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Extra juicy! | Home]

I have git woes, /g/ Today I accidentally merged my dev branch

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 17
Thread images: 2

File: dog-face.jpg (54KB, 668x567px) Image search: [iqdb] [SauceNao] [Google]
dog-face.jpg
54KB, 668x567px
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 (25KB, 558x495px) Image search: [iqdb] [SauceNao] [Google]
dog.gif
25KB, 558x495px
>>
>>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 posts: 17
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]
Please support this website by donating Bitcoins to 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
If a post contains copyrighted or illegal content, please click on that post's [Report] button and fill out a post removal request
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.
This is a 4chan archive - all of the content originated from that site. This means that 4Archive shows an archive of their content. If you need information for a Poster - contact them.