Information

Author(s) Mathieu Jadin
Deadline No deadline
Submission limit No limitation

Sign in

Git: Using several branches

During groupworks, when you are several people to implement different features, you may risk to modify together parts of the same code, which will cause the application to fail if each member pushes its changes independently.

To avoid such issues, the majority of Git users use feature branches. A branch is a pointer towards a linear chain of commits in the history.

The following exemple represents the history of an application:

https://inginious.org/course/git/git_branches/git-branches.svg

The login feature is already implemented but two members of the group are now implementing the menu feature and the user profile. These two features are not finished, nor tested. Using a separated branch allows to save your work without altering the code that has already been tested (in the branch master master). Once your feature in development is ready, you can merge the feature branch with the branch master.

git branch allows you to create a local branch. To create the corresponding remote branch, you need to push it as you did it before for the branch master.


Download the archive which already contains a cloned repository in the subfolder clone. You need to modify the local and remote histories such as they match theimage of this exercise. You need to consider that Starting profile and Starting menu require each an empty files, respectively called profile.txt et menu.txt.

Afterwards, zip the whole folder and upload it.

Note that the remote repository in this exercise is not on GitHub or Bitbucket but inside the folder bare.git of the archive.

Your submission needs to respect the following hierarchy:

git-branch/
├── bare.git/
|   └── [...]
└── clone/
    └── [...]

Max file size: 1.0 MiB
Allowed extensions: .zip