Welcome to Software Carpentry Etherpad!

This pad is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents.

Use of this service is restricted to members of the Software Carpentry and Data Carpentry community; this is not for general purpose use (for that, try etherpad.wikimedia.org).

Users are expected to follow our code of conduct: http://software-carpentry.org/conduct.html

All content is publicly available under the Creative Commons Attribution License: https://creativecommons.org/licenses/by/4.0/

If we all take notes in here it will make it eassier for all to get a completed set of notes. So, let's collaborate!!

Third Session: Python 
Download the data we'll be working with from http://swcarpentry.github.io/python-novice-inflammation/setup/


 

Second Session: GIT

Tell git about yourself:
     git config --global user.name "Name surname"
                               user.email "you@email.com"
                               core.editor "nano -w"  # You can set your preferred editor in here
                               color.ui "auto"

Initialise a directory that git will know about the changes:
    mkdir project_dir
    cd project_dir
    git init    # This creates a hidden directory (.git) that will track the changes in this directory
    
Create a file and add it to git:
    nano guacamole.md   # Write inside 
    git status # shows the file has not been added
    git add guacamole.md # adds the file
    git status # now it shows that a new file has been added to the repository.
    git commit -m "Create the first entry on my first file" # This adds a message to the changes you are commiting.

Find about the history of the repository:
    git log # shows all the commits up to now.

When you've change something, git can tell you what've changed:
    nano guacamole.md # Add something to the file
    git diff # shows you what was already known for git and what's been added and git hasn't tracked. (Check https://unix.stackexchange.com/a/216131/146033 to know more about what the symbols on diff means)
    # if we want to save the changes we add and commit it:
    git add guacamole.md
    git commit -m "added the most important fruite"

If we want to see the difference between the staging area (what's been already add-ed) and what's been commit-ed:
    git diff --staged

Seing history:
    git log -1 # shows you the last commit
    git log -2 # shows you the last two commits
    git log --oneline # shows the log with one line per entry.
    
Reviewing differences between working directory and last version saved for only a particular file:
    git diff HEAD guacamole.md
now with some early changes in the history:
    git diff HEAD~1 guacamole.md # the second last
    git diff HEAD~2 guacamole.md # The third last
    git diff <commitNumber> gucamole.md # where <commitNumber> is the first 5 digits from the version number that you can see on git log.

Oh oh... you've removed the content of the file by mistake... How do you recover the last bit?:
    git status # shows what has happened/changed
    git diff # will show you the differences
    git checkout -- guacamole.md # will recover the latest stag-ed version (or commit-ed) for guacamole.md

Ignoring stuff - for example data files that you don't want to version control:
    nano .gitignore # a hidden file with the list of the files we want to ignore
    *.dat  # ignores all the files that end by .dat
    
Working with remotes (eg. github, gitlab) repositories
1.- create an empty repository in github
2.- Add the remote to your local git:
    git add remote <nameRemote> <urlRemote> # <nameRemote> could be origin the standard, or whatever you want 
3.- Push your changes to github
    git push -u origin master # pushes the changes on master to the remote repository (origin) 

Collaborate using github with others
1.- Add your collaborators under settings/collaborators
2.- Your collaborator will get an invitation and once is accepted they wll able to contribute
3.- Your collaborator can clone your repository:
    git clone <urlGitRepository> <dirName> # You can choose the <dirName> you want to save your repository locally.
    

First session: Unix Shell
The contents of this lesson (and extra exercises can be found at: http://swcarpentry.github.io/shell-novice/)

Please go to http://swcarpentry.github.io/shell-novice/setup/ and download  shell-novice-data.zip. Move the file to your Desktop and unzip it.

http://pad.software-carpentry.org/2017-12-14-UCL

socrative.com RITS


Hi All!

Feel free to add to this list if you think I've missed anything important!

Commands:

If you ever get stuck in vi: 
    hit ESCAPE
    type :q
    press ENTER