b3cwjw
Last Updated: February 09, 2017
·
484
· steveniseki
Stevenm

Git tutorial for beginners

Having mainly used centralised version control systems like TFS and SVN, it has taken me awhile to pick up Git. So I have looked around for some of the best Git tutorials.

Without a doubt, the atlassian git tutorial is the best and easiest for beginners to understand. Git in 5 minutes is also an easy one for beginners. I am just summarizing the information from these tutorials here…

Git basics

git init

The git init command initializes a new Git repository.

git clone

The git clone command creates a copy of an existing Git repository from a central repository.

git add

The git add command moves changes from the working directory to the staging area, preparing a snapshot before committing.

git commit

The git commit takes the staged snapshot and commits it to the project history.

git status

The git status command displays the state of the working directory and the staged snapshot.

git log

The git log command lets you explore the previous revisions of a project.

Remote Git Repositories

git fetch

Fetching downloads a branch from another repository, along with all of its associated commits and files. But, it doesn't try to integrate anything into your local repository. This gives you a chance to inspect changes before merging them with your project.

git pull

Pulling is the automated version of git fetch. It downloads a branch from a remote repository, then immediately merges it into the current branch.

git push

Pushing is the opposite of fetching. It lets you move a local branch to another repository, which serves as a convenient way to publish contributions.

Git Branches

git branch

The git branch command is your general-purpose branch administration tool. It lets you create isolated development environments within a single repository.

git checkout

In addition to checking out old commits and old file revisions, git checkout is also the means to navigate existing branches.

git merge

The git merge command is a powerful way to integrate changes from divergent branches. After forking the project history with git branch, git merge lets you put it back together again.

Undoing changes

git checkout

The git checkout command is used for checking out files, checking out commits, and checking out branches.

git revert

The git revert command undoes a committed snapshot.

git reset

The git reset command undoes changes to files in the working directory.

git clean

The git clean command removes untracked files from the working directory.

Say Thanks
Respond

1 Response
Add your response

28588

Nice summary of Git commands. For a comprehensive Git tutorial, this article is also good: https://www.cloudways.com/blog/git-tutorial-for-beginners-version-control/

10 months ago ·
Filed Under