Git basics to improve your teamwork

  • What is Version Control?
    Is a way that “we” all programmers trap our code changes. We track our code from the beginning and record every update made, we save each step into git. As the name says, we use Git to control every version of our code.
    This gives you a clear view of all of the changes we have made in our code through time so we can see and understand what we did, we can track bugs or go back to previous versions of our code if we need to.

Git is also a great way to get started with the command line! If you are not used to it this will get you on track.

Git Basic Commands

  • Git Clone: for bringing a repository that is hosted somewhere into your local machine.
>> git clone <your_repository>
  • Git add: for when we update, create or deleted files, it can also be folders. We use this command to tell git that we made changes, in other words to track your files and changes in Git.
>> git add . #This will add every change made
  • Git Commit: to save the changes we made in our code.
>> git commit -m "fix: right variable name"
  • Git Push: Once we made changes and we are ready to put them or upload them we use this command, this will upload everything you add and commit to your remote repository, like Github.
  • Git Pull: we use this command to bring every change from our remote repository to our local machine, is the opposite of push.
  • Git Status: shows all of the files that were changed, updated, created or deleted in your local repository.

Knowing this basic command you are ready to improve your teamwork with Git

  1. Formalize Git conventions for your team
    What do I mean with this? Let’s take the example for when we save a file in our computer, maybe we can name it image.jpeg, we as the owner of this file we will know what this means but if someone enters to our computer will have no idea what that image is. That changes if you name the image to siberian-dog.jpeg, now you gave that image a standard and descriptive way of what it is inside.
    Well, Git works similar, it is necessary to establish this standard conventions for branch naming, tagging and coding for your team and follow it as arranged.
  2. Merge your changes properly
    Each member of the team should work on a separate branch. When working in different branches it can happen that you work in some common files and eventually merging it to staging or master.
    You should consider learning Git merge techniques like resolving conflicts and using a text editor that support doing this merge options.
  3. Use tags
    After you or your team are done testing and ready to deploy from your current branch or if you want to preserve the current state as a significant milestone you should create a Git tag.

A tag is a snapshot of the branches state at that instant.

>> git tag milestone-id -m "short message saying what this milestone is about">> git push --tags

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Takeaways from EuroPython 2018 in Edinburgh

Migrate a maven project to Gradle

Kubernetes ETCD Data Store Cluster with TLS Certificate

Startup analytics 101: from seed to scale 🚀

Kubernetes Exploit | What is Kubernetes ? how to exploit exploit K8

Git subtree introduction

Mastering the World of Android Testing (Part 2)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bianca Barria

Bianca Barria

More from Medium

An Intro to Git and GitHub

Basics Git Commands to begin with

Do you ever forget to push your commits?

Top 25 Algorithms every Programmer should know 💻