Free for Students online git repository Github

Git is important in two cases:

A) If you are working in a group on the same project at the same time like:

1- preparing a paper, or 2- developing software.

Git will effectively save a lot of time.

B) Git is also a very fast method to get a backup just by 3 short lines!

git add .

git commit -m “backup”

git push -u origin master

You never need to copy and paste the whole directory into your external backup hard drive. Very soon you need to buy another back up hard drive! So forget it and use Git. Git only replaces what is changed and not every thing. It also saves the history of your workflow.

GitHub is an online platform which let you have a remote Git repository. People have to pay but it is free for professors and students.

Git is very simple to learn and it takes you only 1 hour for start. Gradually, you will learn it professionally.

Here I help you to learn it in less than 30 minutes!

Step 1) Installation:

How to install git on Linux:

How to instal git on Windows:

How to install git on Mac:

More help:

Step 2)

I assume you have a directory like home/MCNP/ and you want to use git for this directory. Do these:

cd home/MCNP

lets go to the crisp directory

git init

This command will initiate git in the current directory.

At this moment you will see a hidden directory with the name of .git made in home/CRISP directory. This is hidden to prevent from being deleted.

git add .

This command will add every thing (files and folders) in the current directory to git (note “.” dot means current path)

git commit -m “first commit”

This command let you put a comment like “first commit” . Your commit should tell a story. Therefore, writing descriptive commit messages keeps your repository well managed.

That’s it! It’s done! Now you have a backup of your data on your PC, here ( home/MCNP/.git ).

If you want to save (push) it also in Github or another server, go to step 6.

Step 3)

Whenever you have a change in your documents and you are sure and want to backup it just do these:

git add .

git commit -m “another comment”

Step 4)

You can check and list all the last commit messages by:

git log

one line of the output will be something like this:

commit f8e0baba0107bae4433965441b95df1af8d3a1e2

“another comment”

Which “f8e0baba0107…. “ is Sha1 or id of that commit.

Step 5)

Assume you have a large change in one of your documents and you are not satisfied, or accidentally have deleted one of your files. Do this:

git status

This will show you what has happened.

You can see the difference between the current file and another commit with specific id or Sha1 by:

git diff f8e0baba0107bae4433965441b95df1af8d3a1e2 — filename

This will show you the difference between the current version of filename and what is in this commit : f8e0baba0107bae4433965441b95df1af8d3a1e2

a) If you want to undo the changes and bring the old version of file from the last commit just do this:

git checkout filename

b) If you want to undo the file content with a specific version even very old, you can simply do this by calling its Sha1:

git checkout df1af8433965441b9d3a1e2bae4539654 filename

Step 6)

If you need to have a remote git repository, you can create a private git repository in Github account and just do these commands after creation:

git commit -m "create github repository"
git remote add origin
git push -u origin master

Posting daily about Python, Nuclear Physicist PhD