GITHUB AND GIT COMMANDS

Git and GitHub

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files.

GitHub is a Git repository hosting service. While Git is a command line tool, GitHub provides a Web-based graphical interface. It is a platform for Open source enthusiast to come together and contribute

GIT COMMANDS

git init

The git init command creates a new Git repository. It converts our current working folder to a Git repository or initialize a new repository.

git add

The git add command adds a change in the working directory to the staging area. It notify Git that you want to include updates to a particular file in the next commit.

git commit

The git commit command captures a snapshot of the project's currently staged changes.

git clone

The git clone command target an existing repository and create a clone, or copy of the target repository.

git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all

This log command returns a pretty git log with one line colorful commit summary, and absolute commit date.

git diff

The git diff command shows the differences between files that haven't been staged yet.

git checkout [branch_name]

The git checkout command changes the current working branch to the specified branch in you can further pass -b if the branch is not already present.

git branch

The git branch command lists all local branches in the current repository.

git reset

Clear the files from staging area

git pull

Fetch and integrate the repository to the local repository

git checkout -b [branch_name]

This git command creates a branch with the 'branch_name' and also goes into it (checks in the newly created branch).

git diff

The git diff command shows the differences between files that haven't been staged yet.

git clone [url]

The git clone downloads the files from the url

git reset

Clear the files from staging area

git pull

Fetch and integrate the repository to the local repository

git push origin

git push origin helps to push the commit to the local repository

git merge [branch_name]

This git command allows user to merge the current branch into the active branch.

git stash

This command temporarily stores all the modified tracked files.

git log follow[file]

This command lists version history for a file, including the renaming of files also.

git rm -r [file-name.txt]

The git remove command remove a file (or folder)

git mv

Move or rename a file, directory or symlink.

git checkout

The git checkout command changes the current working branch to the specified branch in you can further pass -b if the branch is not already present.

git reset

Clear the files from staging area

git pull

Fetch and integrate the repository to the local repository

git checkout -b

The git 'checkout -b' command creates a branch with the and also goes into it(checks in) the newly created branch.

git checkout -b

The git checkout command changes the current working branch to the specified branch in you can further pass -b if the branch is not already present.

git clone

The git clone downloads the files from the url

git reset

Clear the files from staging area

git pull

Fetch and integrate the repository to the local repository

git push origin

git push origin helps to push the commit to the local repository

git merge [branch_name]

This git command allows user to merge the current branch into the active branch.

git stash

This command temporarily stores all the modified tracked files.

git log follow[file]

This command lists version history for a file, including the renaming of files also.

git checkout

The git checkout command changes the current working branch to the specified branch in you can further pass -b if the branch is not already present.

git rm -r [file-name.txt]

The git remove command remove a file (or folder)

git mv

Move or rename a file, directory or symlink.

git log

View the commits history.


Click Here  to navigate to  git-commands.json  and add your favourite Git Command to the list