-
Notifications
You must be signed in to change notification settings - Fork 0
git
- A Version Control System is a software that tracks the file changes of all contributors within a project.
- Originally developed to assist collaborative open source software development by Linus Torvalds (Initiator of Linux development)
- The user chooses which files are tracked and which file changes are recorded.
- All tracked files of a project are stored in a git repository ("repo").
$ git status
Adding files to the staging area, which will be included in the next commit.
$ git add ham.py
$ git add spam.txt
Creating the commit containing the files in the staging area:
$ git commit -m "edited ham.py, created spam.txt"
Registering your user name and email:
$ git config --global user.name "Alfred Hettner"
$ git config --global user.email "hettner.alfred@gmail.com"
Note: This has to be done only once. It does not have to be your GitHub user name or email.
$ git log
Note: You can exit the log by typing "q", if you use the default command line editor vim.
###Connecting a local repository to a central repository
Option 1: Clone the repository to your computer:
$ git clone https://github.com/geoscripting/preparatory-assignment-hettner
Option 2: Create a local repository and connect it to a central repository:
$ git init
$ git remote add origin https://github.com/hettner/my_empty_repo.git
Below you find two videos showing you how to clone a repository and how to create and push commits to GitHub. Note that the files and the URLs in the video will be different from yours. I've added the commands that you should use according to the first assignment above the videos. In the video the Git Bash is used instead of the normal Windows command prompt.
In order to use git you need to have a GitHub Account and git must be installed on your computer.
In order to work on the files in the repository and to add new ones, you need to clone the repository to your computer using the following command.
Note: Replace the user name hettner with your GitHub user name.
$ git clone https://github.com/hettner/A1_TopographicWetnessIndex
Click on the image below to watch the video tutorial.
When you create or edit files, you can track these changes and synchronise them with the remote repository on GitHub using the following git commands.
$ git add answer_question_1.txt
$ git commit -m "added answer_question_1.txt"
$ git push origin main
Click on the image below to watch the video tutorial.
The Software Carpentry provides a good git tutorial <http://swcarpentry.github.io/git-novice/>_.

