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
<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
# view branches git branch # create new branch git checkout -b [branchname] # switch to a branch git checkout [branchname] # delete branch git branch -D [branchname]
git merge [branchname]
Remote Branches 3
# delete remote branches git push origin --delete [branchname]
# 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.
# 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.
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.
- http://git-scm.com/book/ca/v1/Git-Basics-Recording-Changes-to-the-Repository ↩
- https://www.atlassian.com/git/tutorials/using-branches/ ↩
- http://stackoverflow.com/questions/2003505/delete-a-git-branch-both-locally-and-remotely/2003515#2003515 ↩
- https://guides.github.com/features/issues/ ↩
- Closing an issue in the same repository ↩
- https://help.github.com/articles/using-pull-requests/ ↩
- https://help.github.com/articles/about-github-wikis/ ↩
- https://help.github.com/articles/about-repository-graphs/ ↩