Basic Git Commands
Git is a versioning management tool using in projects. Let's get directly into stuff.
Basic commands
git config
git config --global user.email sam@google.com
git init
git add
git add <filename>
git clone
git clone <repo url>
git commit
git commit -m "YOUR COMMIT MESSAGE"
git status
// show pending changes for commit/push.
git push
git push origin master
// push the local changes to remote.
git checkout
git checkout -b <branch name>
// switch/create the the specified branch
git remote
//used to connect with remote repo
git remote -v // list remote repos configured
git remote add origin <repo url> // create a new repo
git branch
git branch // list all git branches
git branch -d <branch name> // delete branch
git pull
// pull the remote change to local in current branch
git rm
//remove file from git
git rm <file_name>
git rm -r <directory_name> // remove directory under git.
git reset
//reset git commits
git reset --soft HEAD~1 // reset the git commits by 1 head. But NOT discard changes
git reset --hard HEAD~1 //reset the git commits by 1 head and discard the changes.