From 90a352d4791a2ece9005252c55c99bc7dd38d0ed Mon Sep 17 00:00:00 2001 From: Adam Reeve Date: Mon, 25 Mar 2013 22:38:21 +1300 Subject: [PATCH 1/7] Update installer and gui information --- index.rst | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/index.rst b/index.rst index 4f7f011..61eba7e 100644 --- a/index.rst +++ b/index.rst @@ -4,18 +4,27 @@ ABI Summer Tutorial: Version Control With Git Getting Started --------------- -If Git isn't installed already, it can be installed from the git-core -package if you're using Linux or by downloading msysGit for Windows. +Git installers for various platforms are available from `git-scm.com`__ +or Git can be installed using a package manager on Linux. -The first thing that must be done before using Git is to tell it +__ http://git-scm.com/downloads + +You may wish to install a graphical client for Git, +there are many available but two good options are +`SourceTree`_ for Windows and Mac or gitg for Linux. + +.. _SourceTree: http://www.sourcetreeapp.com/ + +After installing Git, +the first thing that must be done is to tell Git your name and email address. These will be associated with any commits you make:: git config --global user.name "Adam Reeve" git config --global user.email "aree035@aucklanduni.ac.nz" -If you are using a graphical Git client such as Tortoise Git on Windows -or gitg on Linux there will be an option to edit these settings. +If you are using a graphical Git client +there will be an option to edit these settings. Creating a Repository From ceb95cb73d6c7ec4def0ee1cb953cd83d38433ae Mon Sep 17 00:00:00 2001 From: Adam Reeve Date: Mon, 25 Mar 2013 22:52:22 +1300 Subject: [PATCH 2/7] Add note about using help command --- index.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.rst b/index.rst index 61eba7e..8c79ce9 100644 --- a/index.rst +++ b/index.rst @@ -26,6 +26,12 @@ commits you make:: If you are using a graphical Git client there will be an option to edit these settings. +Note that you can get help on any git command by using +the help command. For example, to see the help for the +config command, run:: + + git help config + Creating a Repository --------------------- From fe7afc828cb572c9aaaeee7f323c081c84f6a7df Mon Sep 17 00:00:00 2001 From: Adam Reeve Date: Mon, 25 Mar 2013 22:57:22 +1300 Subject: [PATCH 3/7] Small clarification updates --- hello.py | 0 index.rst | 14 ++++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) mode change 100755 => 100644 hello.py diff --git a/hello.py b/hello.py old mode 100755 new mode 100644 diff --git a/index.rst b/index.rst index 8c79ce9..3b7c58f 100644 --- a/index.rst +++ b/index.rst @@ -171,7 +171,8 @@ To delete a branch:: git branch -d another_feature -This will give an error if the branch hasn't been merged into another branch. +This will give an error if the branch hasn't been merged into another branch +to save you from accidentally losing changes. Now checkout the branch you created. If there are any differences between your previous head commit and the branch you are checking out, your working @@ -179,7 +180,7 @@ directory will be updated:: git checkout new_feature -You can create a new branch and check it out in one go by using the "-b" option +You can create a new branch and check it out in one step by using the "-b" option to the checkout command:: git checkout -b my_feature @@ -231,7 +232,7 @@ conflicts in multiple files you can keep track of which conflicts have been resolved with the status command. Open that file in your editor and resolve the conflict. -Then mark the conflict as resolved by adding the file:: +Then mark the conflict as resolved by adding the file to the staging area:: git add hello.py @@ -271,7 +272,8 @@ and then make another change at the bottom. Now run:: git add -p hello.py Say yes to adding the first change but no to the second change, -then run :command:`git status`, :command:`git diff`, and +then to see the effect of this, +run :command:`git status`, :command:`git diff`, and then :command:`git diff --cached`. @@ -303,6 +305,9 @@ your change is safely stored away in the list of stashes. Now pop your stashed change off the top of the stash list:: git stash pop + +And have a look at what this has done:: + git status git diff git stash list @@ -377,6 +382,7 @@ your changes to your remote repository:: Now on the web page for your fork of the git_tutorial repository, click on the pull request button and follow the steps to create a new pull request. +If your change is useful then I will merge it and the tutorial will be updated. * :ref:`genindex` From 880cbdfad5285581bd06b21a5d7217af2a6beb5e Mon Sep 17 00:00:00 2001 From: Adam Reeve Date: Tue, 26 Mar 2013 22:38:24 +1300 Subject: [PATCH 4/7] Updates to remotes section, add fetch + pull --- index.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/index.rst b/index.rst index 3b7c58f..ed87e71 100644 --- a/index.rst +++ b/index.rst @@ -256,10 +256,30 @@ show the head commit of the master branch on the origin repository:: git show origin/master +Or to see a log of commits on origin's master branch:: + + git log origin/master + To see all branches including those on remote repositories, you can use:: git branch -a +In order to get the latest changes from a remote repository you use the +fetch command:: + + git fetch origin + +Git also has a pull command that can be useful. This will fetch changes +from a repository and then merge a specified branch. For example, if you +were on your master branch and want to merge changes from origin's master +branch, you could use:: + + git pull origin master + +Often it is best to use fetch rather than pull so that you can first use +:command:`git log` to see what changes you will be merging +before running the merge. + Staging Parts of Files ---------------------- From 6aaa812a7d5906591d54b11edc92464713a1fdc5 Mon Sep 17 00:00:00 2001 From: Adam Reeve Date: Thu, 10 Apr 2014 10:30:02 +1200 Subject: [PATCH 5/7] Add note about setting notepad++ as the editor --- index.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.rst b/index.rst index ed87e71..b16e008 100644 --- a/index.rst +++ b/index.rst @@ -130,6 +130,10 @@ Or if you're on Windows and have TortoiseGit installed, you can use:: git config --global core.editor "notepad2" +Or to use notepad++, see this `stack overflow answer`_. + +.. _stack overflow answer: http://stackoverflow.com/a/2486342 + Now make another change to the file and then add this change to the staging area, then run:: From 272991385fec5a0f86db582b7c6aff9466fdb852 Mon Sep 17 00:00:00 2001 From: Adam Reeve Date: Thu, 10 Apr 2014 10:45:27 +1200 Subject: [PATCH 6/7] Clarify merge conflict resolution section --- index.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.rst b/index.rst index b16e008..500a8bd 100644 --- a/index.rst +++ b/index.rst @@ -234,8 +234,11 @@ Read the output of the merge command to note that there is a conflict in the :file:`hello.py` file. Also run :command:`git status`. When you have conflicts in multiple files you can keep track of which conflicts have been resolved with the status command. -Open that file in your editor and resolve the -conflict. +Open :file:`hello.py` in your editor and you will see conflict markers +around the lines that have been changed on both the conflicting and +merge_conflict branches. +Edit the file to combine the two conflicting changes and remove +the conflict markers. Then mark the conflict as resolved by adding the file to the staging area:: git add hello.py From 7494069e6cb9f091a1c846bd5a6625fcf56b03b8 Mon Sep 17 00:00:00 2001 From: Adam Reeve Date: Wed, 14 Jun 2023 09:16:32 +1200 Subject: [PATCH 7/7] Add .readthedocs.yaml --- .readthedocs.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..cdd5a58 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,13 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.11" + +sphinx: + configuration: conf.py