1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
5/5, 1 rating

Guide On Using Git-GUI and Bitbucket

Summary of the tutorial

Hey guys. Ive pulled this tutorial I made early out of the old programming boards in an effort to keep this tutorial going.

If you are interested in creating and maintaining your own repository and have more than one person working on your team, while using an easy to use Branch versioning tool like Git GUI, I highly recommend checking this tutorial out!

1 Creating Your Own Repository

Hello folks.

Today we're going to be learning about how to Create your own repository using Git and BitBucket.
In the next post, I will go over how to create a branch, make changes, and push the branch up to BitBucket.

What's Git Gui and how will it help you with development?

Git Gui will allow you to make changes to the repository by making new commits, amending existing ones, creating branches that handle the current changes / fixes you are focusing on, performing local merges of different branches, and fetching/pulling to remote repositories.

Let's begin by downloading Git Gui.

You can download Git Gui by going to the website https://git-scm.com/

For Windows PC's click the Download For Windows Button On the Right.
View attachment 4731

Follow the steps through the installation until you reach this window.
I recommend installing this feature because it allows you to right click a file and open Git Gui right away.

View attachment 4732

The download and installation has been completed. So, lets start Git Gui with and create a repository online using BitBucket from a file you have already created.
For this example, we will use Git Gui with BitBucket (Online Repository).

Make sure you have an account with BitBucket (https://bitbucket.org/)
Once you have created an account, navigate to here : https://bitbucket.org/repo/create

View attachment 4735

After you have clicked "Create Repository"

Navigate down to the "I have an existing project" click it, and read the Git Command it generates for you.

Keep that open and follow exactly what it tells you to do except input the directory you want to push to BitBucket.

You will have to now use Git Bash that downloaded with your Git-Scm installation. Simply navigate for it in your start menu and open it.

This is what it should look like.

View attachment 4736

Enter the details that were generated in the BitBucket website but use your own directory that you have your files in.

After you are finished, it should look like this.

View attachment 4737
You will likely not need to do the last 2 commands, however, I would recommend practicing them so you are familiar with bash. You will likely only need to use it one more time, if ever, for beginner portions of Git-Scm.

There is one more step before you have a fully functioning local and online repo connected to eachother.

Right click your folder that you created the repository with and click Git Gui (assuming you clicked the Git Gui option during installation) otherwise, open Git Gui, click "Open Existing Repository", navigate to your folder, and select the folder.

You should now be seeing this.

View attachment 4738

When you load Git Gui, you may get a message to decompress the database, or unlock index, hit OK.

Follow the following steps to push your files up to the online repository.

Step 1: Staging Your Files For Committing
Click "Stage Changed". You'll receive a message to stage a bunch of untracked files. Click "Yes".
Allow some time for all the files to be staged (There's ALOT). If it asks you to Unlock Index, click "Unlock Index".

Step 2: Committing The Files
Enter a commit message in the white box on the bottom. It can be something generic for now, although in the future you want to be as thorough as possible, listing all the changes you have made. For now, we will just put "Setting Up Repository".

Your Git Gui window should look like this.

View attachment 4739

Click the "Commit" button. This will commit ALL the files into the current branch "Master". This should be the ONLY time you ever commit changes to master, unless you know what you are doing.

Step 3: Pushing The Branch Up To The Online Repository
Again, this should be the ONLY time you push the master branch unless you know what you are doing.
Click the "Push" button and click the branch master.

It will ask you for your password. Enter it.

Congratulations! You have now successfully created your first repository with BitBucket and Git.

Please visit my other thread explaining the ins and outs when using Git Gui. It is VERY simple to use!
(Future Thread Placeholder Here)

2 Git Gui Branch Management Explained

In this section of the tutorial, we will learn the ins and outs of the powerful and easy to use
Git Gui Branch Management Tool!

If you have not already installed and and need to set up your first repository, please read the first post, as that goes over that portion.

In this section, I will use videos to demonstrate how to do everything, as it will make understanding and demonstrating what you should be doing a lot easier.

What/Why Use Git Gui?
Git Gui is just a easy (without all the fluff) graphical interface to manage your branches and content.

It is best used when you are sharing the project with more than one developer, and wish to make sure the code your team implements does not conflict with one another, which could lead to massive headaches.

Creating Your First Branch, Making Changes, Pushing To BitBucket, And Merging Your Code To Master

Branch creation is a breeze with Git Gui.

Watch the video below for a tutorial on how to create a branch, make changes to your code, commit those changes to your branch, push the branch up to BitBucket, and safely merge your code into the master file (where your finished code should go)

Since making the video, I've learned that when grabbing a new master, you do NOT need to manually delete the master branch before grabbing a new master. You can simply create the new master by matching tracking and selecting origin/master even if you are already on the master branch or have a master branch in your local repository already. This should save some time when trying to receive the updated master from origin.

Git Gui - Advanced Options

In this video, I'm going to be going through a few of the more advanced options and some really neat ways to improve how you handle the code you are writing.

More videos to come soon! Please leave any questions/comments/suggestions below!