Sitemap

Version controlling system with Git command

4 min readMar 16, 2022

--

Press enter or click to view image in full size

Vision controlling system is like a history book. It helps to track different versions of code and collaborate with other developers. It can update the history from time to time.

What is Version control why use it?

Version control is a system that manages changes to files projects it can make like a tracking system if I make any change, it automatically tracks by git furthermore if we delete anything we can back to the previous state. And another Advance if working team together when your teammate changes any modification you can get that also. In the vision control system, I going to explain git and GitHub.

Git and GitHub

What is git?

Firstly, come to the git, git is the vision control system it is locally tracking to your project or file. It is usually that you use Git if you want to collaborate with other developers on a coding project or work on your own project. you check your vision use the command git –version this command only if you install in git on your computer otherwise it does not work you must download the git using Git official website

what is GitHub?

GitHub is a product that allows your git project in a remote server somewhere(cloud).

Git and GitHub are the same?

No, because important to remember that Git is not a GitHub git is a version control system that you download onto your computer, but GitHub is an online hosting service.

Some git Terminology

Repository

Central location where all the files are being kept. Usually, a directory with set of files.

Branch

a unique set of code changes with a unique name

Origin

Origin is a reference to the remote repository from the project.

Remote

All the members can collaborate on this remote repository we can make to host using GitHub.

Checkout

We can change the repository using this command

Stashing

When you want to switch branches, but you’re working on an unfinished part of your current project, it’s sometimes difficult. You don’t want to commit work that isn’t finished. You can do this with Git stashing. You can switch branches without committing the current branch using the git stash command.

Some git command

Git add command

$ git add.

Git Commit command

$ git commit -m “ Commit Message”

takes everything from the staging area and makes a permanent snapshot of the current state of your repository that is associated with a unique identifier.

Git Push command

$ git push <remote> <branch>

used to upload local repository content to a remote repository

Git Pull command

$ git pull <remote> <branch>

any changes from the GitHub repository and merges them into immediately change to your local repository.

Git Merge command

$ git merge <branch name>

Join two or more development histories together

Git Clone command

$ git clone <remote Url>

used to create a copy of a specific repository or branch within a repository.

Git log Command

$ git log

it shows the most recent commit.

Git status command

$ git status

it displays the state of the working directory.

Git blame command

$ git blame <file name>

It shows modifications on each line.

Get Sayanthan Kathirgamanathan’s stories in your inbox

Join Medium for free to get updates from this writer.

Git ignore command

Create git ignore:

$ touch .gitignore

List the ignored files

$ git ls-files -i --exclude-standard

Git checkout command

Switch to a particular branch

$ git checkout <branch name>

Create a new branch and switch to it:

$ git checkout -b <branch name>

Checkout a Remote branch

$ git checkout <remote branch>

Git stash command

Switch branches without committing the current branch.

Stash's current work:

$ git stash

Saving stashes with a message

$ git stash save "<Stashing Message>"

Check the stored stashes

$ git stash list

Re-apply the changes that you just stashed

$ git stash apply

Track the stashes and their changes

$ git stash show

Re-apply the previous commits

$ git stash pop

Delete a most recent stash from the queue

$ git stash drop

Delete all the available stashes at once

$ git stash clear

Stash work on a separate branch

$ git stash branch

Git fetch command

Downloads branches and tags from one or more repositories.

Fetch the remote repository

$ git fetch <repository Url>

Fetch a specific branch

$ git fetch <branch URL><branch name>

Fetch all the branches simultaneously

$ git fetch –all

Synchronize the local repository

$ git fetch origin

Git revert command

Undo the changes

$ git revert Revert

a particular commit

$ git revert<commit-ish>

Git reset command

Reset the changes:

$ git reset –hard 
$ git reset –soft
$ git reset --mixed

--

--