Git is a modern and widely used distributed version control system in the world. It is developed to manage projects with high speed and efficiency. The version control system allows us to monitor and work together with our team members at the same workspace.
Git is an open-source distributed version control system. It is designed to handle minor to major projects with high speed and efficiency. It is developed to co-ordinate the work among the developers. The version control allows us to track and work together with our team members at the same workspace.
| Definition | : | git config command sets the author name and email address respectively to be used with your commits. |
| Syntax for Author Name | : | git config –global user.name "[name]" |
| Syntax for Email Address | : | git config –global user.email "[email address]" |
| Example for Author Name | : | git config –global user.name "JaladhiSoftTechnology" |
| Example for Email Address | : | git config –global user.email "jaladhisofttechnologies@gmail.com" |
| Definition | : | git init command is used to start a new repository. |
| Syntax | : | git init [repository name] |
| Example | : | git init /home/jaladhisofttechnology/document/jst |
| Definition | : | git clone command is used to obtain a repository from an existing URL. |
| Syntax | : | git clone [url] |
| Example | : | git clone https://github.com/jaladhisofttech/employee.git |
| Definition | : | git branch command lists all the local branches in the current repository. |
| Syntax | : | git branch |
| Example | : | git branch |
| Definition | : | git branch [branch name] command creates a new branch. |
| Syntax | : | git branch [branch name] |
| Example | : | git branch JST |
| Definition | : | git add is used to adds a file to the staging area. |
| Syntax | : | git add [file] |
| Example | : | git add employee |
| Definition | : | git commit records or snapshots the file permanently in the version history. |
| Syntax | : | git commit -m "[Type in the commit message]" |
| Example | : | git commit -m "Updated the Employee Service Class" |
| Definition | : | git commit -a is used commits any files you have added with the git add command and also commits any files you have changed since then. |
| Syntax | : | git commit -a |
| Example | : | git commit -a |
| Definition | : | git diff command shows the file differences which are not yet staged. |
| Syntax | : | git diff |
| Example | : | git diff |
| Definition | : | git diff –staged command shows the differences between the files in the staging area and the latest version present. |
| Syntax | : | git diff –staged |
| Example | : | git diff –staged |
| Definition | : | git diff [firstBranch] [secondBranch] command shows the differences between the two branches mentioned. |
| Syntax | : | git diff [firstBranch] [secondBranch] |
| Example | : | git diff jst jst1 |
| Definition | : | git tag [commitID] command is used to give tags to the specified commit. |
| Syntax | : | git tag [commitID] |
| Example | : | git tag b01775f589389ujghf890382m89nkl0091234 |
| Definition | : | git show [commit] command shows the metadata and content changes of the specified commit. |
| Syntax | : | git show [commit] |
| Example | : | git show n091775f589389ujghf890382m89nkl0094 |
| Definition | : | git log command is used to list the version history for the current branch. |
| Syntax | : | git log |
| Example | : | git log |
| Definition | : | git log –follow [file] command lists version history for a file, including the renaming of files also. |
| Syntax | : | git log –follow [file] |
| Example | : | git log -–follow jst |
| Definition | : | git rm command deletes the file from your working directory and stages the deletion. |
| Syntax | : | git rm [file] |
| Example | : | git rm jst |
| Definition | : | git status command lists all the files that have to be committed. |
| Syntax | : | git status |
| Example | : | git status |
| Definition | : | git reset command unstages the file, but it preserves the file contents. |
| Syntax | : | git reset [file] |
| Example | : | git reset jst.css |
| Definition | : | git reset [commit] command undoes all the commits after the specified commit and preserves the changes locally. |
| Syntax | : | git reset [commit] |
| Example | : | git reset u89ijk09836472nhbgf7483920 |
| Definition | : | git reset [commit] command discards all history and goes back to the specified commit. |
| Syntax | : | git reset --hard [commit] |
| Example | : | git reset u89ijk09836472nhbgf7483d3210 |
| Definition | : | git reset [commit] command discards some history and goes back to the specified commit. |
| Syntax | : | git reset --soft [commit] |
| Example | : | git reset u89ijk09836472nhbgf673h889m83920 |
| Definition | : | git branch -d [branch name] command deletes the feature branch. |
| Syntax | : | git branch -d [branch name] |
| Example | : | git branch -d jst |
| Definition | : | git checkout [branch name] command is used to switch from one branch to another branch. |
| Syntax | : | git checkout [branch name] |
| Example | : | git checkout jst |
| Definition | : | git checkout -b [branch name] command creates a new branch and also switches to it. |
| Syntax | : | git checkout -b [branch name] |
| Example | : | git checkout -b jst |
| Definition | : | git merge command merges the specified branch’s history into the current branch. |
| Syntax | : | git merge [branch name] |
| Example | : | git merge jst |
| Definition | : | git remote command is used to connect your local repository to the remote server. |
| Syntax | : | git remote add [variable name] [Remote Server Link] |
| Example | : | git remote add origin https://github.com/jaladhisofttech/jst.git |
| Definition | : | git push command sends the committed changes of master branch to your remote repository. |
| Syntax | : | git push [variable name] master |
| Example | : | git push origin master |
| Definition | : | git push [variable name] [branch] command sends the branch commits to your remote repository. |
| Syntax | : | git push [variable name] [branch] |
| Example | : | git push origin master |
| Definition | : | git push -all [variable name] command pushes all branches to your remote repository. |
| Syntax | : | git push –all [variable name] |
| Example | : | git push --all origin |
| Definition | : | git push [variable name] : [branch name] command deletes a branch on your remote repository. |
| Syntax | : | git push [variable name] : [branch name] |
| Example | : | git push origin : jst |
| Definition | : | git pull [Repository Link] command fetches and merges changes on the remote server to your working directory. |
| Syntax | : | git pull [Repository Link] |
| Example | : | git pull https://github.com/jaladhisofttech/jst.git |
| Definition | : | git stash save command temporarily stores all the modified tracked files. |
| Syntax | : | git stash save |
| Example | : | git stash save |
| Definition | : | git stash pop command restores the most recently stashed files. |
| Syntax | : | git stash pop |
| Example | : | git stash pop |
| Definition | : | git stash list command lists all stashed changesets. |
| Syntax | : | git stash list |
| Example | : | git stash list |
| Definition | : | git stash drop command discards the most recently stashed changeset. |
| Syntax | : | git stash drop |
| Example | : | git stash drop stash@{0} |