Git
Videos
- Git Intro: https://www.youtube.com/watch?v=zT8mFJwXpWY
- Git Online: https://www.youtube.com/watch?v=1CJt4FkPKxI
Exercises
- Make a repo on Github. Clone it. Commit some code. Push the code.
- Make a second clone of it in a different directory. I will call this repo2, and the previous repo will be repo1. This is to simulate multiple users making conflicting changes to a shared repo.
- Make a feature branch (per the Git Flow methodology) in repo1. Make some changes. Merge those changes back into the trunk. Don't push yet.
- Make a feature branch in repo2. Make some changes that conflict with the changes you made in repo1. Merge those changes back into the trunk. Push.
- Go back to repo1 and try to push. There should be a merge conflict. Resolve it, then push.
- Look at the log. To make it easier to understand how everything is working with the branches and merges, give it the --graph flag.
- Diff your repository against a previous version to see all changes in all files between one version and another.
- Check out an ancestor commit and make changes from there. What does it mean that you are in a detached head state? Check out gitolite.com/gcs if you don't quite understand what's going on.
- Change two files, but don't commit them yet. Oh, wait, one of those changes was a mistake! Check out the previous version of one of the two files that you changed.
- One of your earlier changes introduced a bug, and you want to revert it for everyone. What is the difference between git revert and git checkout? Hint: run those commands and then use git status. After that, check yourself against this post to see if you got it right.