So you have git installed, and you have a repository created! Well done!
Now you need your Swiss Army Knife! The top 10 commands that are sufficient for you to interact with any git-based project!
git remote -v
origin)git fetch origin
# a new branch
git checkout -b my-new-branch
# an existing branch
git checkout my-old-branch
# local
git branch ls
# all branches (including remote)
git branch ls -a
git add my-file.txt
# this opens your local terminal editor
git commit
git push -u origin my-new-branch
# and then afterwards
git push
git pull
main)git fetch origin
git merge origin/main
NOTE: there is a "scary" part of
gitthat takes some getting used to. This is called amerge conflict. It takes some getting used to, and can definitely feel scary at first! It happens when your local changes and your "remote" changes have a conflict (i.e. you both change the same line of the same file).Not to fear! We will walk through this later!
git log
# or a concise version
git log --oneline
# unsaved changes
git diff
# staged changes
git diff --cached
# change against a particular branch
git diff origin/main
So there you go!! Give those a commands a shot. If you get comfortable with those couple of commands, you will be comfortable with git before you know it!