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 status
and 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 status
to 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.ps1
in 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 fetch
to retrieve the changes from the fake remote - Run
git status
to see how yourmaster
branch and the remotemaster
branch have diverged - Run
git merge origin/master
to apply the changes from the fake remote to your master branch - Run
git status
to see the how the local and remote master branches relate - Run
git log --all --oneline --graph
to see the merge commit on the master branch - Run
git push
to deliver your changes to the fake-remote - Run
git status
to see that yourmaster
branch is up-to-date and has no undelivered changes
git push
git fetch
git merge
git log --oneline --graph --all
git clone