Git is a software that is used to maintenance and the version management in complex systems where is involved several participants in one project or the count of files are too many, seek for reliability in the development process and efficiency, but for this reasons, sometimes can be a little more confused to understand it. This is why in this post, the main target is to show you some basic Git commands to survive in the working environment.

git init

Create an empty repository or restart one that already exists. This allows you to begin to work with any repository that doesn’t recognize the git command.

git clone <url>

This command allows you to make a copy from the master branch of the project and stored to your machine (local). You can find the project URL in the main webpage and commonly ends in .git

git clone -b <branch> <URL>

It allows you to download a copy of the project but only the branch that you entered. The URL commonly is found in the project’s repository and it ends in .git extension.

git add -A

It adds all the files which you worked (modify, new and delete) for the next commit. The ‘git add’ command is considered the first one to perform the commit process to remote repository. I mean, the command doesn’t ignore any kind of change.

git add .

It performs the same actions to the previous one

git add -u

It performs only an update of all files that already exists. If you added or deleted some files, this will not process them.

git commit -m “comment

It performs the “encapsulated” process of the files added with the previous commands to consider send it in the next “commit”. -m is a parameter which indicates to add a message that describes the commit, enclosing between quotation marks.

git push origin <branch>

It performs an update of the code made ready for the previous commands in the branch that you indicate. Is important to say that the changes that you has been done must be in the same branch that you are uploading.

git status

It allows you to visualize all the modifies files  (added, deleted and updated)

git branch

It allows you to visualize all the branches available in the remote repository (the project in the cloud) and that they were active locally

git pull origin <branch>

It performs the download of all files located remotely (in the cloud) of a specific branch (could be the same branch or another one). Take in a count that you can execute this command without problems, first you should make a commit to update your own changes with the command that I explained above.

git merge <branch>

It makes files fusion between the branch that you are working and the branch that you wish to merge remotely.

git remote add origin <URL>

This command allows you to add an URL to the current project that is saved locally. This is important to add it because if doesn’t exist a relation between your local code with the remote code, is imposible to make a commit to your project.

git checkout -b <branch>

It allows you to change from a branch to another one for first time adding the name. In case that the branch is already saved locally, you just need to execute the same instruction without -b parameter.

git tag x.x.x

It allows you to add as tag a software version of the last commit in remote. The values in versions stands for: 1) a major change in the first value, 2) a minor change in the second value, and 3) the count of bugs fixed in the third value.

git push origin — tags

It depends with the previous, and the function of this command is to add that tag to the remote commit.

git reset — hard

Remove all changes done, comming back to the last commit done remotely.

I hope these simple commands allows you to survive in the work environment, and if you feel like to learn more I recommend you to read documentation about Git published by Atlassian (


Leave a reply

Your email address will not be published. Required fields are marked *