Configure source control for your project

With Git + BitBucket

Eric Vera
Minimalist Dev
2 min readMay 10, 2017

--

For more on why those technologies checkout “My source control technologies of choice”. If you are new to Git, checkout the links at the end.

Create the repository

This is where you will store your code online.

  1. Sign-in to BitBucket (or create an account if you haven’t yet)
  2. Create a new repository (press the + sign, select repository)
  3. Give it a name and choose your options (like keeping it private or public)

Add a .gitignore file

This assumes you already have a folder with at least one file that you want to add to source control.

As you may have guessed this is what tells Git which files to ignore. Like temporary files, node module folders, or files with user preferences generated by your IDE.

  1. Create a .gitignore file. Some boilerplates/templates create this file for you (like React Native). If it is already there just add any sections you may need.
  2. Go to gitignore.io and enter the technologies that you are using like Operating System, Programming Languages, IDEs. For example for a web project I may use macOS, node, VisualStudioCode which results in this file. You can always add later if you have to.

Create your first commit

  1. Install Git if you haven’t yet
  2. On a terminal/command prompt, cd to the project directory
  3. git init
  4. git add --all — stages all the files to be committed (see the tutorial link below if this does not make sense)
  5. git status — this will show you a list of the files to add. If there are files that you think should not be there you may have to add them to the .gitignore files.
  6. Once everything looks good git commit --m "Initial commit"

Push the changes to BitBucket

  1. Go to your repo page.
  2. At the bottom there should be a link to something like “I have an existing project” with instructions on what to do next. It should look something like git remote add origin https://username@bitbucket.org/username/reponame.git, then git push -u origin master

What now?

This just sets things up. The tutorial below will show you how to create new commits, and deal with branches and other Git concepts.

  • Tutorials— If you are new to Git, this tutorial is really good
  • Cheat Sheet — Looking at a few options this one looked good, but let me know if you find a better one.

Like this article? Press the heart below and share it! Know a better way to do things or just want to say hi? Great! I love learning new and better ways :) Write me at hey at itsmeeric.com.

--

--