Command
Description
initialize current project folder for version control (creates .git files)
show status of current branch: the changes that need to be staged (tracked) or committed
add all changed files to stage/index
remove all staged files from stage
remove files from stage/index
commit changes without message
Edit/overwrite last commit
undo by creating a new commit with reverted changes from previous commit
[Danger] commits (removes all commits until selected one & make changes untracked)
Flags: --hard (force remove changes) , --soft (put changes in stage)
[Danger] restore file from last commit and remove uncommited changes
show history of commits & changes
git log -p --author=userName
show history of commits & changes by specific user
git log -p --since=2.days
show history of commits & changes in time duration (minutes, hours, weeks, etc...)
show when each line was last modified in file & who did it
show all including remote branches
git checkout -b BRANCH_NAME REMOTE_NAME/REMOTE_BRANCH
create new branch from remote
git branch -d BRANCH_NAME
merge a branch to current branch (in new commit)
merge a branch to current branch (editing commits chain of current branch)
git remote add REPO_NAME REPO_URL
git pull REMOTE_REPO_NAME REMOTE_BRANCH_NAME
get remote repo latest files
git fetch REMOTE_REPO_NAME REMOTE_BRANCH_NAME
get remote repo changes history
git push REMOTE_REPO_NAME REMOTE_BRANCH_NAME
git push REMOTE_REPO_NAME --delete REMOTE_BRANCH_NAME