-git init
:initialize git repository in current location
-pwd
:tell you where you are
git status
:tells you the git statusgit add <FILE>
:adds to the staging areagit commit
: opens text editor to commit things in staginggit commit -m
: lets you write commit message inlinegit log
: shows you the log -git log -oneline
:shows you the oneline loggit diff
: diff current changes to last git stategit diff <HASH>/HEAD
~:diff current state to another commit
git checkout <HASH> <FILE>
:revert to the version ingit checkout <HASH>
: revert eeverything to in a detached HEAD state -git checkout main
/git switch main
:to go back
git remote add <NAME> <URL>
:add a remote using thegit remote add origin origin XXXXX
git remote -v
: shows you what remotes you havegit push <REMOTE><BRANCH>
:sends your changes to the remotegit pull <REMOTE><BRANCH>
:pull changes from remote down to local computer- Conflicts may happen during push/pull syncs
git branch <NAME>
: create a branch where you are(i.e. head)git branch -a
: list all the branches you are ongit switch <BRANCH>
: newer way to change branchesgit switch -c <BRANCH>
:create and move to in 1 step -git checkout -b <BRANCH>
:the older way to create and move to branch- pull request: meraging a branch on the remote(i.e. Github)
- update PR by pushing to the branch
- merge the PR in the remote
- delete the branch on the remote
- quick link for for workflow: https://bi-sdal.github.io/training/help-faq.html
git rebase main
: rebases current branch