Skip to content


Subversion checkout URL

You can clone with
Download ZIP

git basics

vmagnin edited this page · 16 revisions

Back to Home

A good online book: Scott Chacon, Pro Git, APress, 2009, a Creative Commons book. Click here for french version.

Most useful commands of git, the fast version control system:

To config git, clone the gtk-fortran remote repository and build the master branch:

git config --global "My name"     # --global means you use the same identity in all repos. 
git config --global "My@email"
git clone
cd gtk-fortran
mkdir build
cd build
cmake ..

To update local repository from remote repository:

git fetch

To work on a branch:

git checkout name_of_the_branch     # import the branch if it does not exist locally
git status

Before changing branch without committing current branch:

git stash

To update a branch from remote repository:

git pull origin
git pull origin name_of_the_branch

To add a new file in the index:

git add file.f90

To avoid committing some files (for example f90 and csv files): git checkout -- *.f90 *.csv

To commit changes:

git commit
git commit -a -m "message about the commit"    # commit all the changes
git push origin name_of_the_branch

To obtain the differences in a file in two different branches:

git diff master gtk3 --

To obtain the list of branches (local and remote) and know the active one:

git branch -a

To delete a local branch:

git branch -d name_of_the_branch
git branch -D name_of_the_branch    # Forcing

To delete a remote branch:

git push origin :name_of_the_branch

To graphically visualize the history and solve problems:


Back to Home

Something went wrong with that request. Please try again.