Have you heard of Git? Have you been wondering what all the buzz is about? Have you heard about all the open source software projects moving to Github? Have you been thinking that it's time to give Git a try yourself? We think it is too, and we think this course will help. This course is a different approach to learning Git than, say, reading online documentation or buying a book on Git because you'll see not only how Git works, but how you should work with Git. We'll show you the situations that you probably find yourself in as a developer all the time and how Git can help you work faster, work with more confidence, and save yourself and your teammates time by supporting a good workflow. We'll show you how Git works in practice, and also how to practice Git. Session One: Git and You In this first session we'll cover getting started with Git and daily workflow which will become second nature to you. We'll get it in your fingers. Not only that, but all the operations we'll use Git for will be completely local to our own systems. One of the things that first piques people's interest in Git is that it's distributed. They wonder what that means and how it affects them. In later sessions we'll understand the answers to questions about the distributed nature of Git, but one side effect of it is that many of Git's operations are completely local to your own computer. A Git repository can live out a useful and completely local life all on one computer, and we'll see that side of working with Git. When this session is complete you'll understand: Theory:
- What does Git do?
- Who came up with Git, and who works on it?
- How Git keeps a history of your project over time
- How Git stores your files
- What are all those really long strings of letters and numbers?
- How a Git repository is structured
- What is Git's index for?
- The components of Git: trees, refs, and blobs
- Working with files in Git
- The standard workflow when committing changes to the repository
- Commits in Git
- Working with git log
- Querying the Git repository
- How to get help on Git
Session Two: Git and Your Team Git has no particular need to work with any repository than the local one on your computer, unlike many other version control systems but that wouldn't be very fun would it? Git really becomes useful when you and your team members use it to facilitate collaborating on a project. We'll start to understand what it means that Git is distributed. One of the first things people wonder when they hear that Git is distributed, or that Git doesn't need a central server, is "Can I still have a central server for my team?". Of course you can, and many teams still work the same way they have with other versioning systems. We'll see how to do that as well as share changes with another computer directly. We'll set up an account on Github and use that to learn how to deal with remote repositories. We'll also learn about very important concept in version control systems: branching. Git makes branching so easy that it's time to learn how you should be integrating branching into your workflow. When this session is complete you'll understand: Theory:
- What are remotes?
- What are some strategies for collaboration with Git?
- How does Git transfer changes?
- How does pulling changes work?
- How does branching work in Git?
- What does rebase do?
- What is the Git stash?
- How does tagging work in Git?
- Cloning a repository
- Pushing, pulling, and fetching changes
- Creating branches
- Pushing and pulling from branches
- Setting up a tracking branch
- Merging and dealing with conflicts
- How and when to rebase
- Seeing who did what with git blame
Session Three: Git in the Real World Session three is all about the how Git works and how you work with Git out there in the wild. Chances are you first heard about Git and Github almost in the same sentence. In fact sometimes it's easy to forget that Github is just a logical extension to Git itself. Github is a wildly popular way to host and collaborate on Open Source software projects using Git. Some of the most important software tools you may use every day are now hosted or mirrored on Github, such as Rails, jQuery, or Postgres. Github's unique philosophy on forking, or branching off developement on a software project, makes it easy for anyone to contribute to their favorite open source tools. We'll dig deeper into how to work with Github. Next we'll go over a whole list of interesting tools Git gives you work a lot faster. Interactive adding, adding using patch mode, interactive merging, and some advanced logging and querying techniques for finding exactly what's been going on in your repository. We'll also cover a very important topic in software development: "screwing things up". Not only do we often really mess up the project we're working on, we can also make mistakes in Git itself. Luckily Git is there to help with both of those kinds of problems. Git provides ways to not only commit changes, which is helpful in itself to any software project, but also to fix, reorder, play back, cherry pick, and recover lost commits. When this session is complete you'll understand: Theory:
- How can I get exactly what I want out of the log?
- How can I find exactly what I want in the repo?
- What is the reflog and what does it do?
- Does the repository require any maintenance?
- How does forking work on Github?
- How can I stay up to date with the original repository?
- How do I submit my commits back to the original repository?
- git add -i
- git rebase -i
- git commit --amend
- git reset, hard and soft
- git revert
- git cherry-pick
- git gc
- git reflog
- Forking a repository on Github
- Submitting a pull request on Github