Git
Git is a version control system we are using in our project.
Basic git commands
Create new Repository
git init
git init --bare // for server
Clone a repo
git clone {repoPath}
git clone {repoPath} . // clones the contents of the repo
Check Status
git status
Staging files
git add {file_path}
git add . // Add all files including new created
git add -u // Add only modified files
Pull
git pull
git pull {origin} {branch}
Commit(local)
git commit -m "my first commit"
Push
git push
git push {origin} {branch} // To a particular branch
Unstaging Files
git rm menu.txt --cached    //file from green to red
git rm food_items/ -r --cached  // folder from green to red
git checkout HEAD filename.ext  // checkout style for file green/red to original
git reset  hash --hard  // reset style for folder green/red to original
Other Commands
Check Log/History
git log
git log -n
Diff
git config --global diff.tool bc3   //Configures difftool
git difftool {path of file} // Shows difference between the versions
Branch
git branch branchName   // To create a new branch
git branch  // checks all local branches & active branch with *
git clone -b {branchName} {remote repo path}
Tags
git tag tagName -m "first tag"  // create local tag
git push --tags // push the local tags to remote branches
git tag -d tagName  // delete local tag
git push --delete origin tagname    // delete remote tag
Remote
git remote -v   // Check remote origin url
Rebase
git rebase -i {hash number}