- git init
- git config --global user.name "franklinobiukwu"
- git config --global user.email "[email protected]"
- git config color.ui auto
- git status
- git add {filename}
- git add . (adds all files to staging area)
- git commit -m "message"
-
git rm --cashed (filename) -> uncommit file
-
git log
-
git show (hash)
-
git diff -> difference between what you have in the current directory and what you have committed
-
q -> quit
-
git restore (filename) -> restores file from initial commit
-
git commit --amend -m "message" -> To ammend your commit message
-
git branch --> list all branches
-
git branch -M (new name) -> rename branch
-
git push -u origin (branch name) -> push to remote repository (main)
-
git remote add origin (remote repostiory) -> add/link remote repository to local repository
-
git pull
-
git branch -> Know what barnches are available on your local machine
-
git branch -r -> Know what barnches are available on your remote machine (-r -> remote)
-
git branch -a -> Know what barnches are available on both your remote and local machine (-a -> all)
-
git branch (new branch name) -> Create new branch
-
git checkout (branch name) -> switch between branches
-
git checkout - -> switch to previous branch
-
git checkout -b (branch name) -> Creates new branch and switch to it.
-
git branch -d (branch name) -> to delet branch (-d -> delete)
-
git merge (branch name) -> Merge branch to origin