DEV Community

Cover image for Git & Github Cheatsheet

Git & Github Cheatsheet

Arjun Porwal on April 06, 2020

Hello Everyone ! Today I am sharing my collection of all everyday use git commands , with usage explanations. This Sheet also contains,...
Collapse
 
mistereric profile image
Mister-Eric

This is handy information. Especially for someone just starting. Thank you for sharing!

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Never tried git stash, so I don't really understand.

Is git rebase --continue eventually similar to git merge? I only tried git merge today.

Collapse
 
sujithq profile image
Sujith Quintelier • Edited

Git stash can be used in this situation:

Assume you are working in a certain branch, modifying and adding stuff.

You need to create urgently a hot fix but you work has not been finished yet and you don’t want to commit the changes yet. You can not switch branches if you have uncommitted changes.

This is where git stash comes into play. It resets the branch to the latest commit but saves a copy with the current state before. Make sure you do a git add . before to include the new files as well.

No you can safely switch branches and make your hot fix.

After that, go back to your previous branch and apply the stash to continue where you left off.

Collapse
 
amirhossainproject profile image
amir-hossain-project

Make sense.
Don't forget to apply "git stash pop" when you will resume work.

Collapse
 
zinox9 profile image
Arjun Porwal

Whoa ! That's really very helpful. Thanks For sharing the information 🤘

Collapse
 
zinox9 profile image
Arjun Porwal

You can try out git stash on some sample files and you will get the idea of what it is.

git rebase --continue works when you started rebasing (git rebase master) a branch with other branch (or master) that was ahead of it.
but yeah, if the branch that you are merging isnt ahead, git rebase might work in one shot.

git merge merges the branches (their commits) into one marking that it was merged from a branch.
Whereas git rebase takes the head of other branch, puts it in base of the branch that you are in, like the other branch was never there.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

It seems to un-add. Easier to use VSCode's Version Control tab, I think.

VSCode's Version Control tab

Thread Thread
 
zinox9 profile image
Arjun Porwal

Yes VSCode's Version Control features , can help you a lot to track all this.

Collapse
 
paras594 profile image
Paras 🧙‍♂️

awesome post !!!

Collapse
 
zinox9 profile image
Arjun Porwal

Thanks Buddy !

Collapse
 
koichadev profile image
Khoi Hoang

Really good! Thanks for sharing!

Collapse
 
zinox9 profile image
Arjun Porwal

I am happy, you found it useful ☺

Collapse
 
codebondco profile image
Collapse
 
tejsinghrana profile image
Tej-Singh-Rana

Good stuff . :)

Collapse
 
zinox9 profile image
Arjun Porwal

Thank You 😄