In this kata we will practice the workflow commonly known as "master based workflow". It is sometimes called Centralized workflow or simplified workflow. Collaboration works by pushing to and pulling from the master branch. This workflow is good for simple projects, or solo projects.
We will work with a fake remote repository, that serves as a standin for one hosted by a service like GitHub or Bitbucket.
Run source setup.sh (or .\setup.ps1 in PowerShell) to setup the exercise.
- Get a local instance of the remote by running the command
git clone fake-remote-repository local-repo - Change to the local repository with the command
cd local-repo - Add a line of text to
README.md - Commit the change
- Run
git statusand notice how your local master branch relates to the remote master branch - Push the change to the remote using the command
git push - Run
git statusto see that you are up-to-date - Add another line of text to
README.md - Commit the change
- Run the command
../fitzgerald-pushes-before-we-do.sh(or..\fitzgerald-pushes-before-we-do.ps1in PowerShell) to simulate a collaborator delivering changes to the fake remote - Push your change. Notice that they are rejected by the remote
- Run the command
git fetchto retrieve the changes from the fake remote - Run
git statusto see how yourmasterbranch and the remotemasterbranch have diverged - Run
git merge origin/masterto apply the changes from the fake remote to your master branch - Run
git statusto see the how the local and remote master branches relate - Run
git log --all --oneline --decorate --graphto see the merge commit on the master branch - Run
git pushto deliver your changes to the fake-remote - Run
git statusto see that yourmasterbranch is up-to-date and has no undelivered changes
git pushgit fetchgit mergegit log --oneline --decorate --graph --allgit clone