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…
The git init command initializes a new Git repository.
The git clone command creates a copy of an existing Git repository from a central repository.
The git add command moves changes from the working directory to the staging area, preparing a snapshot before committing.
The git commit takes the staged snapshot and commits it to the project history.
The git status command displays the state of the working directory and the staged snapshot.
The git log command lets you explore the previous revisions of a project.
Remote Git Repositories
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.
Pulling is the automated version of git fetch. It downloads a branch from a remote repository, then immediately merges it into the current branch.
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.
The git branch command is your general-purpose branch administration tool. It lets you create isolated development environments within a single repository.
In addition to checking out old commits and old file revisions, git checkout is also the means to navigate existing branches.
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.
The git checkout command is used for checking out files, checking out commits, and checking out branches.
The git revert command undoes a committed snapshot.
The git reset command undoes changes to files in the working directory.
The git clean command removes untracked files from the working directory.