Running on Java 19-ea+23-1706 (Preview)
Home of The JavaSpecialists' Newsletter

2.3 Creating a Git Branch for Today's Session

Juppies 2 by Dr Heinz M. Kabutz

Usually when we want to try out some new ideas, we create a branch off our current project and then work in the branch. If our experiments works out as brilliantly as we expected, we can merge those changes back into our main branch. If they don't we can delete the branch without affecting our other work. Every company has slightly different procedures for how they work with Git, but in most cases they will ask their programmers to work in their own branches.

Let's create our own branch session2-shuffling-of-words. This will contain all the changes necessary to shuffle our list of words, so that we do not have the same order of words every time we play the games.

This branch is initially only local. We can now make lots of changes. At every milestone we can commit the change to the current branch. Once we have finished all the changes, we can push them to our remote repository. If the changes are useful, we can also merge them into our main source repository (often called "master").

Note: As from the 1st of October 2020, GitHub will automatically create a "main" branch for us when we create a new repository, instead of a "master" branch. It was felt that the word "master" had too many bad historical connotations. Since this course was recorded in July 2020, we still use "master" as our main branch. Of course, you are welcome to rename your "master" branch to "main".


When you load these comments, you'll be connected to Disqus. Privacy Statement.

Table of Contents

We hope you enjoyed this tutorial. If you did, you will also enjoy our courses. We suggest you start with Extreme Java - Advanced Java, followed by Extreme Java - Concurrency Performance for Java 8.

About the Author

Heinz Kabutz Java Conference Speaker

Java Champion, author of the Javaspecialists Newsletter, conference speaking regular... About Heinz

Superpack '22

Superpack '22 Our entire Java Specialists Training in one huge bundle more...

Free Java Book

Dynamic Proxies in Java Book
Java Training

We deliver relevant courses, by top Java developers to produce more resourceful and efficient programmers within their organisations.

Java Consulting

We can help make your Java application run faster and trouble-shoot concurrency and performance bugs...

Java Emergency?

If your system is down, we will review it for 15 minutes and give you our findings for just 1 € without any obligation.