git logo

Basic Git Commands

EBAVS/ Try to work hard in lastest technologies. We work with git for several years and we learned a lot.

This is a simple reference guide with commands that we use in day to day from the beginning of project.

Initialising Repo with Git

First of all we create a project (actually we download skeletons from composer, but this is another history or post):

Then we initialise git repository. This is important because git make their local repository for local working:

Working with Repository

When you initialized we can begin work, then create a simple file for testing:

then add simple code:

now add this file to repository:


Now we have a repository with some of code. It’s time to move this code, we have code added but isn’t in the repo yet. Write:

The files are commited to repo, are stored into this and assigned a short guid identifier 6f30a7f for us.

Go to change index.php and see what happens in next commit:

And change to:

Look that we add -a parameter. This means that we change a file. If we only add files don’t need -a parameter.

We have our application ready to store in remote server. We could make a remote in github or in bitbucket. I Have preference for bitbucket because I can make private repos for free. But github is good too.

When we make repository, in github for example, they make a new url for the repository, the url construction are:

User are your username and Repo are the repository name.  For this example a real url could be:

Then is time to add this remote repository to our local repository:

We have connected now our local repo with our remote repo, time to move code to remote:

And we have our repo working.


commands that we used:


0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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