Version control and GIT
Version control and GIT
file1.f90
, filea.f90
or file1a.f90
is the latest version.git-hub
, bitbucket
, code.google
, etc.Bitbucket 101
tutorial is a good place to start if you are new to version controlgit init
or (simpler) create it on github and clone it to your
local computer using git clone
.git config --global user.name "Kalle Anka"
git config --global user.email "Kalle@Anka.se"
The local repository has three parts:
HEAD
pointing to the last commit made.Files can be in three stages
You check by using git status
git add file.txt
git status
/ git diff
git commit -m "Message"
git commit -m 'initial commit'
git add forgotten_file
git commit --amend
git reset HEAD file.txt
git checkout -- file.txt
commit 22f11a96c33cb1dba52bde7e62587bf2d56772b9
Author: Daniel Appelo <daniel.appelo@colorado.edu>
Date: Tue Jan 16 13:44:23 2018 -0700
Commit two
commit f2a2971ff715ae801f84dd93c5626c010e46404b
Author: Daniel Appelo <daniel.appelo@colorado.edu>
Date: Tue Jan 16 13:43:52 2018 -0700
Commit one
commit 12d3ece48d33711b32c6af8c61ceac31bab422a4
Author: Daniel Appelo <daniel.appelo@colorado.edu>
Date: Tue Jan 16 13:41:08 2018 -0700
Initial commit
Git almost only adds so it is very hard to loose data in an unrecoverable way.
Showing the name of the remotes and their adress
$ git remote
origin
$ git remote -v
origin https://github.com/appelo/hello-world.git (fetch)
origin https://github.com/appelo/hello-world.git (push)
Pushing your local changes to the remote
git push origin master
Show git fetch
and git merge origin/master
time permitting.