Git

Git is a tool that can help you track changes in your files, specially when you share your files with your friends on a Linux server.

Here is a very simple description:

log into your server
ssh foobarserver

go to your folder where you want to track files
cd to/your/folder/for-git-tracking/test/

create a local git repository
git init

Add your files to the local repo
git add myfile.sh

or add more files at once
git add .

Commit your changes to the repo, give a message -m, so that your friends can understand what you have done
git commit -m "myfile.sh: first commit" myfile.sh

or commit all files in current directory (the character “.” is the directory where your files are.)
git commit -m "My files, snapshot" .

Now, start editing your file:

vim myfile.sh

or

nano -w myfile.sh

After saving your changes, do:

git commit -m "myfile.sh: I have changed an important part in this file" myfile.sh

or
git commit -m "My files, here is my explanation of the changes" .

Later on, you can do:

to see the log and the changes done
git log

did you forget to commit some files, or did someone change something?
git status

Leave a Reply

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