Institute of Computer Science
  1. Courses
  2. 2018/19 spring
  3. Collaboration Tools in Software Engineering (LTAT.05.009)
ET
Log in

Collaboration Tools in Software Engineering 2018/19 spring

  • Main
  • Lessons
  • Resources

Practice 4: Branching

By the end of this practice, you will know how to

  1. List, create, delete branches in Git
  2. Switch branches in Git
  3. Merge branches in git

Branching

  1. Fork (see last practice) the repository for this practice: https://github.com/Stopa/cse-prac4-branching
  2. Clone your fork of the repository to your computer
  3. Create a new branch answers and switch to it
  4. Make sure you are on branch answers, not master. Use git status and git branch to see where you are
  5. Use the commands introduced in the lectures or any third-party software to inspect the repository. Find answers to the following questions; write them to a file answers.txt and commit the file to the repository:
    1. What branches exist in this project?
    2. What branch has been merged into master?
    3. How many commits (in total) does the repository have?
    4. What commits belong to branch package that don't belong to the branch master?
  6. Switch back to the branch master.
  7. Create a new file 7.txt and commit it to the repository
  8. Look at the commit history with branches. See how the branch answers branches out from master
  9. Merge the branch answers into master
  10. Look at the commit history with branches. See how the branch answers merges back into master, but the pointer of answers is still on a separate branch.
  11. By default, Git pushes only the current branch. You need to push a branch explicitly, as shown in the lecture. Or you can use git push --all to push information of all branches.
  12. Push all changes to the remote using git push --all
  13. git branch can accept many arguments that we didn't look at in the lecture. You can use git branch --no-merge to see branches that have not been merged into the current branch or git branch --merge to see branches that have been merged
  14. Use git branch --merge to see what branches have been merged into master and delete them. When deleting branches, remember that Git doesn't delete remote branches. use git push origin --delete <branch> to delete the required branches also in the remote

When everything is done, send a link to the Github page of your repository to the instructor in Slack.

Don't forget to fill the Quiz!

  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment