Nabila Ayu

A Brief Git Guide for Teams

Learn about basic Git commands and Gitflow to help you set up your first [let’s be honest, this is your gazillionth 😌] Git team project.

An illustration depicting a team of coworkers planning on a project
Illustration by pixeltrue

Before we get started, it’s important to highlight that the key to a great project output is strong communication. Git does help your team to develop efficiently without as many constraints on location, but that just means your team is more prone to an error caused by miscommunications.

In this article, you’ll find out about the how-to on git, what Gitflow is, and later learn why communication is an integral part of it.

Let’s Get to the Basics

The bigger the dev team, the bigger the chance work conflicts may arise. It gets messy. Then, you might ask, how can I avoid it? Git.

Git is a version control software that lets you keep track of your work and the changes you made throughout. It can be applied to any type of files, though it is especially useful for dev teams with its code-related work.

All you need to do is type a few commands here and there from the command line and the system will take care of the rest.

Starting your local repository

git clone [project url]

↳ Download a project with its entire commit history from the URL into your local repository. git init [project name] will create one straight from the command line, if you haven’t created a project from the website.

Working on the project

git add [file]

↳ Add a file to add for your next commit down into the directory tree (staging).

git commit -m "[message]"

↳ Commit the added changes from staging.

git stash

↳ Put changes made in the current branch into stash for later use. Stash works like a stack. git stash pop to continue working from the changes saved to the top of the stash.

Branch and Merge

git branch [branch name]

↳ Create a new branch. git branch will list all your branches.

git checkout [branch name]

↳ Switch to the specified branch and make it the working directory.

git merge [from branch name]

↳ Merge the specified branch into the working directory.

Synchronize repositories

git remote add [alias] [url]

↳ Add a remote git URL as an alias, kinda like bookmarks so you don’t have to reference a long URL every time.

git pull [remote]

↳ Fetch changes from the remote branch and merge the current branch to the upstream.

git push [alias] [branch]

↳ Push local branch commits to the remote repository branch.

Rewrite History

git revert [commit sha]

↳ Create a new commit that inverses the changes on the specified commit. This will not remove the commit from the changes history.

git rebase [rebase]

↳ Changing the base of your branch from one commit into another, so making it as if you’re working off the latest branch update.


Gitflow is the workflow that dictates what kind of branches to set up and how to merge them together. It helps your team as a starting point to organize a development project from idea to production.

An illustration of how gitflow works
Git Flow by Atlassian
  • Develop: This workflow uses the develop branch, instead of master, to continuously integrate features. Whereas the master branch will act as the official release history.
  • Feature: Exactly as its name suggests. This branch is where each new feature will reside and later merge to develop branch when it’s done.
  • Release: When a set of features is fit for a release, you will make a new release branch off of develop to merge with master when it’s the due date.
  • Hotfix: This branch forked directly off of master to quickly patch up production releases.

Gitflow in action

Now, I will show an example of how I have used Gitflow as the workflow of choice for an on-going software development group project.

A screenshot of a list of branches currently in the author’s group project git repository.
A screenshot of a list of branches currently in the author’s group project git repository.

This is currently how the branches set up on our git project. In accordance with the Gitflow illustration before, you might notice a few differences.

Our staging branch will act as a develop branch in our project repository. And the PBI-[num]-[name] will define each of the product’s features — or in this case, backlog items (PBI).

You probably wondered why there are no branches with functions similar to release or hotfix. It’s because you can utilize Gitflow as you see fit. You don’t have to carry out all the branches listed out in Gitflow if you don’t need all of them yet or if it hinders your performance.

Food for Thought

And there you have it! your dev team should be ready to tackle a new Git project. It does take more than a little bit of self-discipline and communication for each of the team members to finesse. But at the end of the day, you’ll save a lot more time and effort with Git than without it.

An aspiring UI/UX Designer, also a Junior @ CSUI