GIT – The benefits of properly using version control in projects

February 16, 2020

In this blog, I want to address some of the main features of why it’s so important to properly use version control in your projects.

One of the major reasons why you should use version control in your projects can be summarized into one word: “Structure”.

As a developer, you want to have a structured workflow when working on complex projects.
Setting up your project correctly from the beginning can become an extremely valuable asset in the future, especially when things start to get a little more complex.

Structure is something that git can offer you. We also use git ourselves in projects like our website reviews WordPress plugin.
Git is distributed version control software that allows users to track changes in source code during software development.

Use version control in projects

GIT workflow:

The way people use and implement GIT varies from project to project. Trying to explain all the ins and outs of working
with GIT simply isn’t possible within one blogpost let alone one paragraph.

Therefore I just wanted to introduce you to one of the most commonly used workflows routines, which is stated below:

Open a pull request–> adding commits –> Pushing your commits  –> (And if necessary: merging new requests)

  1. Pulling –  (looks for changes, and if found it fetches them from the remote repository to your working directory).
  2. Committing – (requesting changes to the repository).
  3. Pushing  –  (pushing those changes into the remote repository).
  4. Merging –  (merges two or more changes from the same file/project, most commonly used when working with branches).

How to use Git:

Git is easily accessible by using the command line as well as by using easy to use desktop applications like GitHub-desktop, Sourcetree & tower.

Git commands:

When you start working with GIT it’s very important to understand all the commands that come with it. But instead of manually looking for them. We’ve already assembled a list of the most useful commands you can use to optimize your git workflow.

List of our top 12 GIT commands:

  1. Git commit -m “message”
    Commits your changes to the current branch and also prompts the user to document a message about their latest commit.
  2. Git clone
    Establishes an editable copy of a local/remote repository.
  3. Git init
    Easily initialize your project repository
  4. Git Push
    Upload your local changes to a remote repository
  5. Git Pull
    Fetches and merges all updates from the remote server to your working directory.
  6. Git commit –amend
    The –amend parameter allows you to modify your latest commit conveniently.
  7. Git status:
    Returns a list of all the files you’ve changed and those you still need to add or commit
  8. Git branch
    Displays all the current branches within your project.
  9. Git clean -n
    Delete untracked files in the local working directory. (Can be very useful for cleaning up your project folder)
  10. Git merge
    Merges a different branch into your active branch.
  11. Git add -A
    Stage all (new, modified, deleted) files.
  12. Git reset –hard
    Resets the index and working tree. Any local changes to tracked files in the working tree since the last commit are removed.