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 |
| |
| commit current staged changes with message |
| add all changed files then commit (Doesn't add new files just the tracked files) |
| |
| |
| move pointer to selected commit |
| undo by creating a new commit with reverted changes from previous commit |
git reset --flag commit_id | undo by removing changes from previous commit totally
flags: --hard : remove from stage & directory --mixed : remove from stage not directory --soft : doesn't remove from stage or directory |
| remove file from stage & project repository |
git rm --cached file.extension | |
| show history of commits including author & date |
| show when each line was last modified in file & who did it |
|
| |
| show all including remote branches |
git branch new_branch_name | |
| |
git checkout -b new_branch_name | create new branch and moves to it |
git branch -d branch_name | |
| merge a branch to current branch |
|
git remote add give_name repository_https_or_ssh | |
git remote set-url remote_name new_link | change remote repository link |
| show all remote repositories |
git clone repository_https_or_ssh | clone a remote repository |
| pull project from remote to local repository |
| push commits from local to remote repository |
git pull given_name branch_name | |
git push given_name branch_name | |
git fetch given_name branch_name | pull from a branch but doesn't merge with local files |
git push given_name --delete branch_name | |