You can create a new local repository with the specified name
$ git init [project-name]
Or you can download an existing project and its entire version history
$ git clone [url]
To show the differences between your local copy and the github version
$ git status
Untracked file
is a file that is not yet committed to the master branch. To add the file to the list of files to be merged with master, use git add.
$ git add [file-name]
Instead of a file name, the flag -A
can be used for all
Now the new file is in the project and can be committed to the master branch. Currently, its status is Change to be committed
To commit changes
$ git commit –m [added new file]
where the -m
indicates a message regarding the changes to commit. The file is now added to the repository, but only locally. To sync changes to github
$ git push
This takes everything from your machine and pushes it to github branch.
To grab online updates and merges them with your local work
$ git pull
git pull
is a convenient shortcut for completing both git fetch
and git merge
in the same command:
$ git fetch
Fetches updates made to a remote repository, and
$ git merge origin
Merges updates made online with your local work