Download from Download - https://git-scm.com/download/
- Access GitHub using - https://github.com/
- git config --global user.name ""
- git config --global user.email ""
- git init : initialises a new GIT repository. This will initialize a .git file in the folder
- git status : compares working directory, staging area and current branch
- git add : add all the changes at that point in time from local or working directory to staging area
- git commit : commit the changes from staging area to the current branch
- git config : set or get the configuration parameters
- git log : show history or log of project commits
- git log : shows the history of all commits for the passed branch
- git log : shows the history of all commits prior to passed commit reference
- git log --all : shows the history of all commits for the entire repository
- $ git log --author “” : shows the history of all commits by author on the current branch
- $ git log --since “” : shows the history of all commits by period on the current branch
- $ git log --until “” : shows the history of all commits till date on the current branch
- git show : shows the history and differences introduced by commit reference
- git diff : shows the difference between working directory and HEAD
- git diff : shows the difference working directory and commit reference
- git diff --cached : shows the difference working directory and staging area ready to be committed
- git remote add origin : To set remote by adding the remote to specified repository
- git remote -v : list remote repositories
- git push -u : push to and set default upstream for
- git fetch : fetches files from remote origin master to tracking branch
- git merge : merges the changes in tracking branch to local branch
- git pull origin master : pull the code from origin for master
- git clone : Clone the project if already available
Branching - GIT follows a tree structure - Root will be the master branches and we create sub-branches as a copy of master branch
- git branch -c : creates a new branch
- git checkout : check out or switch to the
- git checkout -b : create a new branch and switch to it
- git branch : lists all the branches in the repository with an indicator on current branch
- git push -u origin
- git pull origin
- git branch -d : deletes the branch
- git checkout
- git pull origin
- git merge : merge changes from source branch to destination branch
- git stash : stores the uncommitted changes from working directory and index state as WIP
- git stash list : lists the uncommitted changes in the current branch
- git stash pop : apply the uncommitted changes back to the working directory
A fast-forward merge happens when the target branch (merged_branch) was branched from the current branch (master) and there are no changes to current branch since then. An automatic merge happens when the two histories have diverged, but GIT is able to reconcile them into one set of changes. This creates a new commit on current branch (master)