Here is a brief overview of the git workflow for those just starting out.
Start by creating a project repository in the github site. Include a README file, and a License file (usually GNU GPL 3.0). You can use the website to edit your README file so it holds a preliminary overview of your project.
For future reference, suppose your git username is gituser and your repository is named repo.
Cloning makes a copy of your repository on your local machine and establishes the inner linkages so that it’s easy to “push” changes you make locally to the github site.
To clone the repository you need to know the url of the repository, which is going to be
In the shell (on windows, use the git shell), make sure you are in your home directory and use the command
$ git clone http://github.com/gituser/repo.git
This will create a directory on your computer called repo and will copy the files from the remote github site into that directory.
Now you are set up to edit those files, create new files, and so on.
At this point, there is a marker, called a ‘commit’ in the history of your repo, set to this point. Whatever you do, you can always get back to this state.
Edit, create, delete, tinker with files however you want. Do this until you reach a point where you would
like to preserve your progress for the future, at which point you will move to step 2.
Don’t wait too long, move on fairly frequently to record incremental progress.
To set a checkpoint in your work, you will take the following steps: First, check the status of your git repository.
$ git status On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: README.md Untracked files: (use "git add <file>..." to include in what will be committed) new_file.txt working.py no changes added to commit (use "git add" and/or "git commit -a")
$ git add README.md new_file.txt working.py $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: README.md new file: new_file.txt new file: working.py
$ git commit -m 'A message describing your changes' 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 new_file.txt create mode 100644 working.py
$ git status nothing to commit, working tree clean
$ git push
Once you’ve created the repository, the sequence is:
git addto tell git you want to track things
git commit -m messageto commit your changes to the record
git pushto put them in the cloud.
$ git status
to know where things stand!