Git Tutorial

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

File Status Lifecycle and Commits 1

git commit
git reset HEAD~1
git checkout HEAD~2

Branches 2

<check in early, check in often> what is `master`?

A branch represents an independent line of development. Branches serve as an abstraction for the edit > stage > commit process discussed in Git Basics, the first module of this series. You can think of them as a way to request a brand new working directory, staging area, and project history. New commits are recorded in the history for the current branch, which results in a fork in the history of the project.

git branches diagram

Local Branches

# view branches
git branch
# create new branch
git checkout -b [branchname]
# switch to a branch
git checkout [branchname]
# delete branch
git branch -D [branchname]

Merge Branches

git merge [branchname]

Remote Branches 3

# delete remote branches
git push origin --delete [branchname]


what is origin?

# view remote branches
git remote -v
# add remote branches
git remote add [repositoryname] [branch_url]
# clone a repository into a new directory
git clone
# push to repository
git push [repositoryname] [branchname]
git pull

Power Tools with Github

Issues & Milestones 4

Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. They’re kind of like email—except they can be shared and discussed with the rest of your team. Most software projects have a bug tracker of some kind. GitHub’s tracker is called Issues, and has its own section in every repository.

Code 5

# commit to fix issue
git commit -m "fix #34"

Once you’ve collected a lot of issues, you may find it hard to find the ones you care about. Milestones, labels, and assignees are great features to filter and categorize issues. A milestone acts like a container for issues. This is useful for associating issues with specific features or project phases

 Pull Request 6

Pull requests let you tell others about changes you’ve pushed to a repository on GitHub. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary.

 Wiki 7

Just as writing good code and great tests are important, excellent documentation helps others use and extend your project.

Every GitHub repository comes equipped with a section for hosting documentation, called a wiki.

Repository Graphs 8

Every repository has graphs that display data about traffic, contributors, and commits.


Learn Git


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s