Table Of Contents
To initialize a git repo
To init a git project
cd <path to root folder of project>
git init
To check the status of changed files
To check the status of files for changes
git status
To add file for commit
To add all changed files
git add -A
To add all changes in current directory
git add .
To add specific files
git add <file path>
To add multiple files
git add <file1 path> <file2 path>
To commit files to git
To make a commit with a commit messae
git commit -m "commit message"
Managing remote repos
Adding a remote URL
git remote add origin <repo URL>
To add multiple remote URL
git remote add <any key for remote URL> <repo URL>
To push code to remote repo
git push
To pull code from remote repo
git pull
Manipulating git branches
To create a new branch using current branch as base
git checkout -b <new branch name>
To checkout to existing branch
git checkout <branch name>
To push the new branch to remote repo
git push -u <remote key> <branch name>
To merge a branch’s code to current branch
git checkout <current branch>
git merge <other branch>
Stashing
To stash a code without commit
git stash
To pull a stashed code
git stash pop