r/github • u/FamiliarBorder • May 07 '20
Git Commands. Hope it helps you. Source: ig/ml.india
2
2
1
u/Louve-Ynia May 07 '20
"git branch -a" to see all the existing branches
"git remot add orgin <link>" the link is in ssh, not http(s)
3
1
u/Ast3r10n May 07 '20
What use is git status for starting a repo? I guess it’s there due to muscle memory.
1
u/PipMasterFX May 07 '20
What about git rebase? Will I ever need to use that or stick to git merge?
2
u/bearassbobcat May 07 '20
git rebase is awesome. My workflow is to commit often and use git rebase to create smaller more targeted (ie atomic) commits as I can just don't use it on branches others will be using unless you want problems
you can then merge or cherry pick those commits as needed
there's only so much space in a one page cheat sheet though so maybe that's why they didn't include it
1
u/PipMasterFX May 07 '20
I like your workflow. How does that affect GitHub commits? If you’ve done 7 commits for the day and rebased it into 1, does it still show as 7 or does it become 1 on GitHub?
1
u/load_up_on_hummus May 07 '20
Would sure be nice if there were some descriptions for folks that are unfamiliar with these commands.
Also, I wouldn’t consider git rm —cached <file name> to be in the staging category. This command is used to remove a file from Git tracking, a separate concept altogether.
9
u/MattRighetti May 07 '20
Now to switch branches you should use git switch 😁