Note: a few older servers may not have git installed. If you need git added to your server, contact support
Here is how to quickly store all your files in git:
1. ssh to the server
git config user.name "Your name here"
git config user.email "firstname.lastname@example.org"
git add .
git commit -m "Initial commit"
make some changes, then
If you have created new files, add them to git. Either add them all with :
git add .
or add them individually with:
git add file1 file2 path/to/file3 file4 long/path/to/this/file
Finally, commit your changes:
git commit -m "Version 2"
In all these examples we use git to backup our entire home directory by performing:
at the start of each checkin/add/etc.
There are many arguments against this and you are of course welcome (and perhaps even advised in most cases) to cd instead to the directory your project is in.
If you would like to make some changes to your working code (or have already made changes and want to revert back quickly), type:
git branch experimental
(you can use whatever name you like in place of “experimental”)
git checkout experimental
Make your changes (if you haven’t already made some), then type :
git commit -a
Your changes are now committed into the experimental branch.
To get back to your working code, type:
git checkout master
and you should be back to your working version of the code.
To totally abandon all your changes and go back to the last checked in version in your current branch:
git reset --hard HEAD