>>> git config
Description: This command sets the author name and email address respectively to be used with your commits
Usage:
git config –global user.name “Promise Chukwuenyem”
git config –global user.email “promisepreston@gmail.com”
>>> git init
Description: This command is used to start a new repository
Usage: git init elibrary
>>> git clone
Description: This command is used to obtain a repository from an existing URL.
Usage: git clone https://promisepreston1@bitbucket.org/vggdev/elibrary.git
>>> git add
Description: This command adds a file to the staging area.
Usage: git add [file]
>>> git commit
Description: This command records or snapshots the file permanently in the version history.
Usage: git commit -m “[ Type in the commit message]”
1. Others: git commit -a
Description: This command commits any files you’ve added with the git add command and also commits any files you’ve changed since then.
>>> git diff
Description: This command shows the file differences which are not yet staged.
Usage: git diff
1. Others: git diff –staged
Description: This command shows the differences between the files in the staging area and the latest version present.
2. Others: git diff [first branch] [second branch]
Description: This command shows the differences between the two branches mentioned.
>>> git reset
Description: This command unstages the file, but it preserves the file contents.
Usage: git reset file.css
1. Others: git reset eb60981ca80722fd321e65a94f11fb82ccadbb7c
Description: This command undoes all the commits after the specified commit and preserves the changes locally.
2. Others: git reset –hard eb60981ca80722fd321e65a94f11fb82ccadbb7c
Description: This command discards all history and goes back to the specified commit.
>>> git status
Description: This command lists all the files that have to be committed.
Usage: git status
>>> git rm
Description: This command deletes the file from your working directory and stages the deletion.
Usage: git rm file.css
>>> git log
Description: This command is used to list the version history for the current branch.
Usage: git log
>>> git show
Description: This command shows the metadata and content changes of the specified commit.
Usage: git show eb60981ca80722fd321e65a94f11fb82ccadbb7c
>>> git branch
Decsription: This command lists all the local branches in the current repository.
Usage: git branch
1. Others: git branch branch_name
Description: This command creates a new branch.
2. Others: git branch -d branch_name
Description: This command deletes the feature branch.
>>> git checkout
Description: This command is used to switch from one branch to another.
Usage: git checkout branch_name
1. Others: git checkout -b branch_name
Description: This command creates a new branch and also switches to it.
git merge
Usage: git merge [branch name]
This command merges the specified branch’s history into the current branch.
git remote
Usage: git remote add [variable name] [Remote Server Link]
This command is used to connect your local repository to the remote server.
git push
Usage: git push [variable name] master
This command sends the committed changes of master branch to your remote repository.
Usage: git push [variable name] [branch]
This command sends the branch commits to your remote repository.
Usage: git push –all [variable name]
This command pushes all branches to your remote repository.
git pull
Usage: git pull [Repository Link]
This command fetches and merges changes on the remote server to your working directory.
git stash
Usage: git stash save
This command temporarily stores all the modified tracked files.
Usage: git stash pop
This command restores the most recently stashed files.
Usage: git stash list
This command lists all stashed changesets.
Usage: git stash drop
This command discards the most recently stashed changeset.
git checkout
git merge
git remote
git push
git pull
git stash