Loading...

GIT Repository

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.

GIT Config

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"

GIT INIT


Definition : git init command is used to start a new repository.
Syntax : git init [repository name]
Example : git init /home/jaladhisofttechnology/document/jst

GIT CLONE


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

GIT BRANCH


Definition : git branch command lists all the local branches in the current repository.
Syntax : git branch
Example : git branch

GIT BRANCH [BRANCH NAME]


Definition : git branch [branch name] command creates a new branch.
Syntax : git branch [branch name]
Example : git branch JST

GIT ADD


Definition : git add is used to adds a file to the staging area.
Syntax : git add [file]
Example : git add employee

GIT COMMIT

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"

GIT COMMIT -A


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

GIT DIFF


Definition : git diff command shows the file differences which are not yet staged.
Syntax : git diff
Example : git diff

GIT DIFF –STAGED


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

GIT DIFF [FIRSTBRANCH] [SECONDBRANCH]


Definition : git diff [firstBranch] [secondBranch] command shows the differences between the two branches mentioned.
Syntax : git diff [firstBranch] [secondBranch]
Example : git diff jst jst1

GIT TAG


Definition : git tag [commitID] command is used to give tags to the specified commit.
Syntax : git tag [commitID]
Example : git tag b01775f589389ujghf890382m89nkl0091234

GIT SHOW


Definition : git show [commit] command shows the metadata and content changes of the specified commit.
Syntax : git show [commit]
Example : git show n091775f589389ujghf890382m89nkl0094

GIT LOG


Definition : git log command is used to list the version history for the current branch.
Syntax : git log
Example : git log

GIT LOG –FOLLOW [FILE]


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

GIT RM


Definition : git rm command deletes the file from your working directory and stages the deletion.
Syntax : git rm [file]
Example : git rm jst

GIT STATUS


Definition : git status command lists all the files that have to be committed.
Syntax : git status
Example : git status

GIT RESET


Definition : git reset command unstages the file, but it preserves the file contents.
Syntax : git reset [file]
Example : git reset jst.css

GIT RESET [COMMIT]


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

GIT RESET -HARD [COMMIT]


Definition : git reset [commit] command discards all history and goes back to the specified commit.
Syntax : git reset --hard [commit]
Example : git reset u89ijk09836472nhbgf7483d3210

GIT RESET -SOFT [COMMIT]


Definition : git reset [commit] command discards some history and goes back to the specified commit.
Syntax : git reset --soft [commit]
Example : git reset u89ijk09836472nhbgf673h889m83920

GIT BRANCH -D [BRANCH NAME]


Definition : git branch -d [branch name] command deletes the feature branch.
Syntax : git branch -d [branch name]
Example : git branch -d jst

GIT CHECKOUT [BRANCH NAME]


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

GIT CHECKOUT -B [BRANCH NAME]


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

GIT MERGE


Definition : git merge command merges the specified branch’s history into the current branch.
Syntax : git merge [branch name]
Example : git merge jst

GIT REMOTE


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

GIT PUSH


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

GIT PUSH [VARIABLE NAME] [BRANCH]


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

GIT PUSH -ALL [VARIABLE NAME]


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

GIT PUSH [VARIABLE NAME] : [BRANCH NAME]


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

GIT PULL [REPOSITORY LINK]


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

GIT STASH SAVE


Definition : git stash save command temporarily stores all the modified tracked files.
Syntax : git stash save
Example : git stash save

GIT STASH POP


Definition : git stash pop command restores the most recently stashed files.
Syntax : git stash pop
Example : git stash pop

GIT STASH LIST


Definition : git stash list command lists all stashed changesets.
Syntax : git stash list
Example : git stash list

GIT STASH DROP


Definition : git stash drop command discards the most recently stashed changeset.
Syntax : git stash drop
Example : git stash drop stash@{0}