Commands
Config
- git config --list
- git config --global user.name “user-name”
- git config --global user.email “example@mail.com”
- git config --global core.editor code
- git config --global push.default matching
- git config --global core.excludesfile ~/.gitignore_global
Create
git initgit clone [remoteurl] [directoryname]
Check Status
- git status
Stage file
git add .git add <path>git add -p
Staged file
git diff --staged
Add changes
git add [folder]/*
Commit changes
git commit -m “Commit message”
Pull changes from remote
git pull
Remote
git remote rm [origin]git remote -vgit remote add origin [remote git url]
Branching
git branchgit branch -m [newname]git branch -m [oldname] [newname]git checkout -b [newbranch] [createfrom]git push --set-upstream origin [branchname]git push origin :[branchtodelete]
Tagging
git tag [tagname]git tag -a [tagname] -m “[message]”
Push
git pushgit push [remotename] [branchname]git push -u origin --allgit push -u origin --tags
Change Author
git filter-branch -f --env-filter ”
GIT_AUTHOR_NAME=‘Nirbhay Singh Rao’
GIT_AUTHOR_EMAIL=‘nirbhay@live.in’
GIT_COMMITTER_NAME=‘Nirbhay Singh Rao’
GIT_COMMITTER_EMAIL=‘nirbhay@live.in’
”HEAD