Intro:
By Corey M Schafer link
Notes:
Video 1/6:
git --version
git config
git init
git status
git ignore
git add -A
git reset
also --soft,--hardgit commit -m "<commit message>"
git log
git remote -v
- `git branch -a ' : lists local and remote branches
git diff <commit_1> <commit_2>
: Difference between 2 commitsgit pull origin master
git push origin master
git branch
: Lists all the branches locallygit branch <branch_name>
: Creates new branchgit checkout <branch_name>
git merge <branch_name>
git branch -d <branch_name>
git push --delete origin <branch_name>
Video 2/6:
git checkout
: undo recent uncommited changesgit commit --amend -m ""
: change message of the latest commit. But changes the git hstorygit commit --amend
: incase u forgot to commit a file, doing this will add it to the latest commit. Do this only if you haven't pushed your changes to other people(because it changes the git history)git log --stat
: Shows detailed logsgit cherry-pic
git reset --soft
: resets to specified commit but later files stay in stafing areagit reset
: resets to specified commit but later files DONT stay in staging areagit reset --hard
: removes later filesgit clean -df
: cleans the staging areagit reflog
: logs of what you've been doing. And u can restore using checkout and the hash shown. But hwne we do this, we'll be in a detached head state. so, we need to save these changes by creating another branchgit revert
: This adds a new commit without changing the git history.
Video 3/6:
git stash save "message"
: saves changes and reverts the filegit stash list
: lists all the stash messagesgit stash apply stash@{}
: puts back the changes. But doesnt remove the stash's saved messagesgit checkout --.
: undosgit stash pop
: takes the recent stash and applies it and removes that saved stashgit stash drop stash@{}
: removes the specified saved stashgit stash clear
: removes all saved stashes
Video 4/6:
- diffmerge - A tool for viewing and merging with a GUI
Video 6/6 : Difference between add -a, add -A and other ways of adding files to the staging area...
git add -A
: all in the git directorygit add -A
: Adds files below this directorygit add
: same as abovegit add --no-all
: doesn't stage deleted filesgit add -u
: doesn't add untracked filesgit add .
: Adds files from current directorygit add *
: wont be able to add hidden/deleted files as is* is a shell command