How to Use GIT

Utilities like GIT and sites/services like GitHub, BitBucket, etc. all encourage and help coders organize their work.

Git is extremely easy to use, once you get the basic concepts down.

Most people that say Git is complicated, don’t understand how simple it can be.


Some basic Git Commands and Example Usage:

Create a new repository

git init


Cloning a project:

git clone

when using a remote server you’ll usually include the user info such as

git clone username@host:/path/to/repository

Cloning a project:

git clone

You can propose changes (add it to the Index) using

git add 
git add *

This is the first step in the basic git workflow.

To actually commit these changes use

git commit -m "Commit message"

Now the file is committed to the HEAD, but not in your remote repository yet.

Your changes are now in the HEAD of your local working copy.

To send those changes to your remote repository, execute

git push origin master

Change master to whatever branch you want to push your changes to.

If you have not cloned an existing repository and want to connect your repository to a remote server, you need to add it with

git remote add origin 

Now you are able to push your changes to the selected remote server

Leave a Reply

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