Skip to content

Commit

Permalink
Merge pull request #134 from UCL/week3-git
Browse files Browse the repository at this point in the history
Updates for week 3
  • Loading branch information
dpshelio authored Oct 17, 2018
2 parents 0c09fc0 + 539ab0e commit d6f118a
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 203 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ script:
- python -c "import matplotlib.pyplot"
- make
before_install:
# Remove the MongoDB repo as their GPG key has expired.
# - sudo rm /etc/apt/sources.list.d/mongodb-3.2.list
- openssl aes-256-cbc -K $encrypted_194007bb00f1_key -iv $encrypted_194007bb00f1_iv
-in secrets.tar.enc -out secrets.tar -d
- tar -xvf secrets.tar
- REPO=`git config remote.origin.url`
- SSH_REPO=${REPO/https:\/\/github.com\//[email protected]:}
- eval `ssh-agent -s`
- chmod 600 deploy_key
- ssh-add deploy_key
- sudo add-apt-repository -y ppa:mc3man/trusty-media
- sudo apt-get -y update
- sudo apt-get -y install ffmpeg
Expand Down
13 changes: 5 additions & 8 deletions ch02git/02Solo.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions ch02git/03Mistakes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"import os\n",
"top_dir = os.getcwd()\n",
"git_dir = os.path.join(top_dir, 'learning_git')\n",
"working_dir=os.path.join(git_dir, 'git_example')\n",
"working_dir = os.path.join(git_dir, 'git_example')\n",
"os.chdir(working_dir)\n",
"working_dir"
]
Expand All @@ -49,9 +49,9 @@
"\n",
"The commit we want to revert to is the one before the latest.\n",
"\n",
"`HEAD^` refers to the commit before the \"head\", which is the latest change. That is, we want to go back to the change before the current one. \n",
"`HEAD` refers to the latest commit. That is, we want to go back to the change before the current `HEAD`. \n",
"\n",
"We could have used the hash code to reference this, but you can also refer to the commit before the `HEAD` as `HEAD^`, the one before that as `HEAD^^`, the one before that as `HEAD~3`. We could also refer to it with the hash code, e.g. 73fbeaf"
"We could use the hash code (e.g. 73fbeaf) to reference this, but you can also refer to the commit before the `HEAD` as `HEAD^`, the one before that as `HEAD^^`, the one before that as `HEAD~3`."
]
},
{
Expand Down Expand Up @@ -88,7 +88,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"A commit may pop up, with some default text which you can accept and save. "
"An editor may pop up, with some default text which you can accept and save. "
]
},
{
Expand Down Expand Up @@ -371,7 +371,7 @@
"source": [
"### Covering your tracks\n",
"\n",
"The silly spelling is gone, and *it isn't even in the log*. This approach to fixing mistakes, \"rewriting history\" with `reset`, instead of adding an antipatch with `revert` is dangerous, and we don't recommend it. But you may want to do it for small silly mistakes, such as to correct a commit message."
"The silly spelling *is no longer in the log*. This approach to fixing mistakes, \"rewriting history\" with `reset`, instead of adding an antipatch with `revert`, is dangerous, and we don't recommend it. But you may want to do it for small silly mistakes, such as to correct a commit message."
]
},
{
Expand All @@ -380,7 +380,7 @@
"source": [
"### Resetting the working area\n",
"\n",
"When git reset removes commits, it leaves your working directory unchanged -- so you can keep the work in the bad change if you want. "
"When `git reset` removes commits, it leaves your working directory unchanged -- so you can keep the work in the bad change if you want. "
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions ch02git/04Publishing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"import os\n",
"top_dir = os.getcwd()\n",
"git_dir = os.path.join(top_dir, 'learning_git')\n",
"working_dir=os.path.join(git_dir, 'git_example')\n",
"working_dir = os.path.join(git_dir, 'git_example')\n",
"os.chdir(working_dir)\n",
"working_dir"
]
Expand Down Expand Up @@ -74,13 +74,13 @@
"source": [
"### Paying for GitHub\n",
"\n",
"For this software carpentry course, you should use public repositories in your personal account for your example work: it's good to share! GitHub is free for open source, but in general, charges a fee if you want to keep your work private. \n",
"For this course, you should use public repositories in your personal account for your example work: it's good to share! GitHub is free for open source, but in general, charges a fee if you want to keep your work private. \n",
"\n",
"In the future, you might want to keep your work on GitHub private. \n",
"\n",
"Students can get free private repositories on GitHub, by going to [https://github.com/edu] and filling in a form. \n",
"Students can get free private repositories on GitHub, by going to [GitHub Education](https://github.com/edu) and filling in a form (look for the Student Developer Pack). \n",
"\n",
"UCL pays for private GitHub repositories for UCL research groups: you can find the service details on our [web page](../../infrastructure/github.html)."
"UCL pays for private GitHub repositories for UCL research groups: you can find the service details on our [web page](https://www.ucl.ac.uk/isd/services/research-it/research-software-development/github/accessing-github-for-research)."
]
},
{
Expand Down
16 changes: 7 additions & 9 deletions ch02git/05Collaboration.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ch02git/06ForkAndPull.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@
"\n",
"* Fork and Pull Request are things happening only on the repository's server side (GitHub in our case). Consequently, you can't do things like `git fork` or `git pull-request` from the local copy of a repository.\n",
"\n",
"* You not always need to fork repositories with the intention of contributing. You can fork a library you use, install it manually on your computer, and add more functionality or customise the existing one, so that it is more useful for you and your team. \n",
"* You don't always need to fork repositories with the intention of contributing. You can fork a library you use, install it manually on your computer, and add more functionality or customise the existing one, so that it is more useful for you and your team. \n",
"\n",
"* Numpy's example is only illustrative. Normally, Open Source projects have in their Wiki a set of instructions you need to follow if you want to contribute to their software.\n",
"* Numpy's example is only illustrative. Normally, Open Source projects have in their documentation (sometimes in the form of a wiki) a set of instructions you need to follow if you want to contribute to their software.\n",
"\n",
"* Pull Requests can also be done for merging branches in a non-forked repository. It's typically used in teams to merge code from a branch into the master branch and ask team colleagues for code reviews before merging.\n",
"\n",
"* It's a good practice before starting a fork and a pull request to have a look at existing forks and pull requests. You can find the list of pull requests on the vertical menu on right hand side. Try to also find the network graph displaying all existing forks of a repo, like this example in the NumpyDoc repo: https://github.com/numpy/numpydoc/network"
"* It's a good practice before starting a fork and a pull request to have a look at existing forks and pull requests. On GitHub, you can find the list of pull requests on the horizontal menu on the top of the page. Try to also find the network graph displaying all existing forks of a repo, like this example in the NumpyDoc repo: https://github.com/numpy/numpydoc/network"
]
}
],
Expand Down
154 changes: 0 additions & 154 deletions ch02git/09GitTheory.ipynb

This file was deleted.

36 changes: 29 additions & 7 deletions ch02git/10Branches.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"## Branches\n",
"\n",
"Branches are increadibly important to why `git` is cool and powerful.\n",
"Branches are incredibly important to why `git` is cool and powerful.\n",
"\n",
"They are an easy and cheap way of making a second version of your software, which you work on in parallel,\n",
"and pull in your changes when you are ready."
Expand All @@ -23,7 +23,7 @@
"import os\n",
"top_dir = os.getcwd()\n",
"git_dir = os.path.join(top_dir, 'learning_git')\n",
"working_dir=os.path.join(git_dir, 'git_example')\n",
"working_dir = os.path.join(git_dir, 'git_example')\n",
"os.chdir(working_dir)"
]
},
Expand Down Expand Up @@ -94,12 +94,28 @@
"git branch"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%writefile Wales.md\n",
"Mountains In Wales\n",
"==================\n",
"\n",
"* Pen y Fan\n",
"* Tryfan\n",
"* Snowdon\n",
"* Glyder Fawr\n",
"* Fan y Big\n",
"* Cadair Idris"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -313,7 +329,8 @@
"metadata": {},
"source": [
"Local branches can be, but do not have to be, connected to remote branches\n",
"They are said to \"track\" remote branches. `push -u` sets up the tracking relationship."
"They are said to \"track\" remote branches. `push -u` sets up the tracking relationship.\n",
"You can see the remote branch for each of your local branches if you ask for \"verbose\" output from `git branch`:"
]
},
{
Expand Down Expand Up @@ -816,7 +833,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"To quickly grab a file from one branch into another.\n",
"to quickly grab a file from one branch into another. This will create a copy of the file as it exists in `<branch>` into your current branch, overwriting it if it already existed.\n",
"For example, if you have been experimenting in a new branch but want to undo all your changes to a particular file (that is, restore the file to its version in the `master` branch), you can do that with:\n",
"\n",
"```\n",
"git checkout master test_file\n",
"```\n",
"\n",
"Using `git checkout` with a path takes the content of files.\n",
"To grab the content of a specific *commit* from another branch,\n",
Expand Down
Loading

0 comments on commit d6f118a

Please sign in to comment.