DEV Community

Discussion on: 6 Git commands every beginner should memorize

Collapse
 
kevinhch profile image
Kevin

Don't forget about:

git push origin master --force
:)
Collapse
 
auroraskye profile image
Aurora Skye

Trololololol...

Collapse
 
perpetualwar profile image
Srđan Međo

I appreciate the joke :)

Collapse
 
exadra37 profile image
Paulo Renato

You can appreciate the joke as an experienced developer in git, that knows the implications of using it, but we need to be careful when trying to make jokes for the ones that don't get the context of it, specially when the article is targeting beginners.

Thread Thread
 
jeremy profile image
Jeremy Schuurmans

I thought it was pretty funny myself, but you also make a good point. Thank you for bringing it up!

Thread Thread
 
perpetualwar profile image
Srđan Međo

I agree, hence my acknowledgement of the joke for what it is.

Collapse
 
eromanowski profile image
Eric • Edited

and

git pull origin master
git reset --hard
git stash
git stash pop

merging into master should be done via pull request imho

Collapse
 
mandaputtra profile image
Manda Putra
git push upstream master --force

Cause you are on forked repo

Collapse
 
exadra37 profile image
Paulo Renato

This is a very bad advice, and should be never used, not even in solo projects, because you get into a bad habit that can have pretty nasty consequences in a professional environment, like Jenkin developers accidentally do "git push --force" to over 150 repos on github.

I don't have the link anymore, but I read a story once of a company that took months to recover from a git push --force to their master branch.

To be on the safe side ALWAYS configure your Github, Gitlab or whatever you use to not accept push to master.