This repository has different branches for showcasing git's branch management capabilities.
- Fork this repo at your own github account and clone it twice.
- Configure username and email.
- Configure credential helper.
- Create new project. Add .gitignore for the proper files. Stage and commit.
- Check the commit history of the repository. What is the parent of your latest commit?
- Push.
- Now go to the second local repository. Change some file that you committed previously and try to pull.
- Why can’t you pull?
- Stash. Pull. Apply stash. Commit. Push.
- Create new branch from the master. Add some changes and commit.
- Show which branch on which commit is placed.
- Push the branch and set upstream.
- Show again the history with information about which branch on which commit is placed.
- Merge your branch into master.
Okay, that was easy, eh.
- Show all remote references.
- Create local tracking branch for origin/release-1.0.
- Merge in the local branch release-1.0 the branch origin/feature33.
- Check the history with showing the diverging commits. Are there any? Compare the local branch release-1.0 and its upstream remote tracking branch.
- Push the changes and check the history again.
- Merge into release-1.0 the origin/feature34 branch. Resolve the merge conflict.
- Push the release-1.0 branch in the repo.
- Change file and stage it. Now unstage it.
- Unmodify the file to committed state.
- Modify something, commit it to a new branch and push it.
- Now amend the commit. Show in the history that the commit is in practice completely different. Push it to the repo.
- Why can’t you push to the repo?
- Create new branch from master and cherry pick the latest commit from feature33. Check the history now.
- Now imagine with this commit a bug was added so it has to be reverted.
- Checkout the mistaken-gitignore branch. Add to .gitignore rule to ignore .class files and remove from the latest commit all .class files.
- Checkout local tracking branch of origin/user-story-3.
- Rebase it on the remote tracking branch origin/release-0.5. Is there a difference between origin/user-story-3 and user-story-3?
- Try to push the branch.
- Why just a simple push is not possible?
- Force push it.
- Checkout local tracking branch of origin/release-0.5. Merge into it user-story-3. Does it generate merge commit?
- Now checkout local tracking branch of origin/move-feature-3. Rebase it on the local tracking branch release-0.5.
- Yep, there is a merge conflict. Now abort the rebase.
- Try again the same rebase, resolve the merge conflict and finish the rebase.
- Checkout local branch from origin/exercise-rebase-i.
- Add fixup commit to commit 6aa6b29 to fix the spelling error.
- Use interactive rebase to:
- Squash the fixups.
- Split commit 675652b into two commits. File1.txt and File2.txt must go into the first one. File3.txt must go into the second one.
- Commit b49ab90 must go before commit 675652b.