Getting Started With Git and GitHub

Explaining Git and GitHub. Forked from Jaime Kosoy.

Hands on / interactive learning

Purely text based resources

The Git Flow

The following snippet is designed to explain Vincent Driessen’s git branching model, at least as well as I understand it. Special thanks to Stephen Koch for being the true master here.

A way to think about Git and Github.

Milestones of milestones of milestones. In other words:

Setting up

Assuming your project is in a folder named “Project” on your Desktop.

Starting from scratch

cd ~/Desktop/Project
git init
git checkout -b develop
touch README.md

Cloning an existing repository.

Updating/The Development Cycle

You now have a git repository, likely with two branches: master and develop. Now bake these laws into your mind and process:

####You will never commit to master directly. ####You will never commit to develop directly.

Instead, you will create feature branches on your machine that exist for the purpose of solving singular issues. You will always base your features off the develop branch.

	git checkout develop
	git checkout -b my-feature-branch

This last command creates a new branch named “my-feature-branch” based off of develop. You can name that branch whatever you like. You should not have to push it to Github unless you intend to work on multiple machines on that feature.

Make changes.

git add .
git commit -am "I have made some changes."

This adds any new files to be tracked and makes a commit. Now let’s add them to develop.

git checkout develop
git merge --no-ff my-feature-branch
git push origin develop

Releasing

Finished with your project?

Replace 1.0.0 in the snippet here with your appropriate versions. Now you have a tag saved.