From f4c7bfe4bc3a421cd62291f17e60effcb29eb083 Mon Sep 17 00:00:00 2001 From: Lancelot the Brave Date: Tue, 13 Aug 2024 11:39:31 +0100 Subject: [PATCH 1/4] fix: make git commands work --- ch00git/05Collaboration.ipynb.py | 7 ++++++- ch00git/10Branches.ipynb.py | 1 + ch00git/11Miscellany.ipynb.py | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ch00git/05Collaboration.ipynb.py b/ch00git/05Collaboration.ipynb.py index ad46fe53..19c65e63 100644 --- a/ch00git/05Collaboration.ipynb.py +++ b/ch00git/05Collaboration.ipynb.py @@ -114,6 +114,7 @@ ================== * Ben Eighe +* Ben Nevis * Cairngorm # %% jupyter={"outputs_hidden": false} language="bash" @@ -188,6 +189,7 @@ # git diff # %% jupyter={"outputs_hidden": false} language="bash" +# git add Wales.md # git commit -am "Translating from the Welsh" # %% jupyter={"outputs_hidden": false} language="bash" @@ -206,6 +208,7 @@ * Snowdon # %% jupyter={"outputs_hidden": false} language="bash" +# git add Wales.md # git commit -am "Add a beacon" # %% jupyter={"outputs_hidden": false} language="bash" @@ -296,6 +299,7 @@ * Fan y Big # %% jupyter={"outputs_hidden": false} language="bash" +# git add Wales.md # git commit -am "Add another Beacon" # git push @@ -313,6 +317,7 @@ * Glyder Fawr # %% jupyter={"outputs_hidden": false} magic_args="--no-raise-error" language="bash" +# git add Wales.md # git commit -am "Add Glyder" # git push @@ -354,7 +359,7 @@ # Now commit the merged result: # %% jupyter={"outputs_hidden": false} language="bash" -# git commit -a --no-edit # I added a No-edit for this non-interactive session. You can edit the commit if you like. +# git commit -a --amend --no-edit # I added a No-edit for this non-interactive session. You can edit the commit if you like. # %% jupyter={"outputs_hidden": false} language="bash" # git push diff --git a/ch00git/10Branches.ipynb.py b/ch00git/10Branches.ipynb.py index d47af667..73fd0240 100644 --- a/ch00git/10Branches.ipynb.py +++ b/ch00git/10Branches.ipynb.py @@ -139,6 +139,7 @@ # git diff Scotland.md # %% jupyter={"outputs_hidden": false} language="bash" +# git add Scotland.md # git commit -am "Commit Aonach onto main branch" # %% [markdown] diff --git a/ch00git/11Miscellany.ipynb.py b/ch00git/11Miscellany.ipynb.py index 98556287..f13e56f9 100644 --- a/ch00git/11Miscellany.ipynb.py +++ b/ch00git/11Miscellany.ipynb.py @@ -59,6 +59,7 @@ # %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash" # git tag -a v1.0 -m "Release 1.0" +# git push origin --delete v1.0 # clear the tag if it already exists # git push --tags # %% jupyter={"outputs_hidden": false} @@ -68,6 +69,7 @@ ======================== * Cross Fell +* Ingleborough # %% jupyter={"outputs_hidden": false} language="bash" # git add Pennines.md From b07043f534f7dae8eb7dd734ac9acb89e93069fa Mon Sep 17 00:00:00 2001 From: Saransh Chopra Date: Wed, 14 Aug 2024 16:09:12 +0100 Subject: [PATCH 2/4] informative language MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: David Pérez-Suárez --- ch00git/11Miscellany.ipynb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch00git/11Miscellany.ipynb.py b/ch00git/11Miscellany.ipynb.py index f13e56f9..f6470aa3 100644 --- a/ch00git/11Miscellany.ipynb.py +++ b/ch00git/11Miscellany.ipynb.py @@ -59,7 +59,7 @@ # %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash" # git tag -a v1.0 -m "Release 1.0" -# git push origin --delete v1.0 # clear the tag if it already exists +# git push origin --delete v1.0 # clear the tag if it already exists on the remote origin # git push --tags # %% jupyter={"outputs_hidden": false} From 874b82da332fb3a59523cd4d4bf31f321eb7685f Mon Sep 17 00:00:00 2001 From: Saransh Chopra Date: Wed, 14 Aug 2024 17:06:51 +0100 Subject: [PATCH 3/4] don't teach -a --- ch00git/02Solo.ipynb.py | 13 ------------- ch00git/03Mistakes.ipynb.py | 6 ++++-- ch00git/04Publishing.ipynb.py | 11 +++++++---- ch00git/05Collaboration.ipynb.py | 23 ++++++++++++++--------- ch00git/10Branches.ipynb.py | 5 +++-- ch00git/11Miscellany.ipynb.py | 7 ++++--- ch00git/12Remotes.ipynb.py | 3 ++- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/ch00git/02Solo.ipynb.py b/ch00git/02Solo.ipynb.py index ca5bfe30..3f04a89b 100644 --- a/ch00git/02Solo.ipynb.py +++ b/ch00git/02Solo.ipynb.py @@ -283,15 +283,6 @@ def wsd(code): # %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} # cat index.md -# %% [markdown] -# ### Commit with a built-in-add - -# %% jupyter={"outputs_hidden": false} language="bash" -# git commit -am "Change title" - -# %% [markdown] -# This last command, `git commit -a` automatically adds changes to all tracked files to the staging area, as part of the commit command. So, if you never want to just add changes to some tracked files but not others, you can just use this and forget about the staging area! - # %% [markdown] # ### Review of changes @@ -334,9 +325,5 @@ def wsd(code): C->I: Add content of index.md note right of C: git commit -m "Add a lie" I->R: Commit change to index.md - -note right of C: nano index.md -note right of C: git commit -am "Change title" -C->R: Add and commit change to index.md (and all tracked files) """ wsd(message) diff --git a/ch00git/03Mistakes.ipynb.py b/ch00git/03Mistakes.ipynb.py index 96db4842..d33fee0a 100644 --- a/ch00git/03Mistakes.ipynb.py +++ b/ch00git/03Mistakes.ipynb.py @@ -94,7 +94,8 @@ # git diff # %% jupyter={"outputs_hidden": false} language="bash" -# git commit -am "Add a silly spelling" +# git add index.md +# git commit -m "Add a silly spelling" # %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash" # git log --date=short @@ -166,7 +167,8 @@ note right of C: vim index.md -note right of C: git commit -am "Add another mistake" +note right of C: git add index.md +note right of C: git commit -m "Add another mistake" C->I: Add mistake I->R: Add mistake diff --git a/ch00git/04Publishing.ipynb.py b/ch00git/04Publishing.ipynb.py index 769f1436..8ec2fd72 100644 --- a/ch00git/04Publishing.ipynb.py +++ b/ch00git/04Publishing.ipynb.py @@ -125,7 +125,8 @@ # ### Git will not by default commit your new file # %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} magic_args="--no-raise-error" language="bash" -# git commit -am "Try to add Lakeland" +# git add lakeland.md +# git commit -m "Try to add Lakeland" # %% [markdown] # This didn't do anything, because we've not told git to track the new file yet. @@ -135,7 +136,7 @@ # %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash" # git add lakeland.md -# git commit -am "Add lakeland" +# git commit -m "Add lakeland" # %% [markdown] # Ok, now we have added the change about Cumbria to the file. Let's publish it to the origin repository. @@ -184,7 +185,8 @@ # Because we "staged" only index.md, the changes to lakeland.md were not included in that commit. # %% jupyter={"outputs_hidden": false} language="bash" -# git commit -am "Add Helvellyn" +# git add lakeland.md +# git commit -m "Add Helvellyn" # %% jupyter={"outputs_hidden": false} language="bash" # git log --oneline @@ -208,7 +210,8 @@ note right of C: git commit -m "Include lakes" I->R: Make a commit from currently staged changes: index.md only -note right of C: git commit -am "Add Helvellyn" +note right of C: git add lakeland.md +note right of C: git commit -m "Add Helvellyn" C->I: Stage *all remaining* changes, (lakeland.md) I->R: Make a commit from currently staged changes diff --git a/ch00git/05Collaboration.ipynb.py b/ch00git/05Collaboration.ipynb.py index 19c65e63..6e4c9881 100644 --- a/ch00git/05Collaboration.ipynb.py +++ b/ch00git/05Collaboration.ipynb.py @@ -190,7 +190,7 @@ # %% jupyter={"outputs_hidden": false} language="bash" # git add Wales.md -# git commit -am "Translating from the Welsh" +# git commit -m "Translating from the Welsh" # %% jupyter={"outputs_hidden": false} language="bash" # git log --oneline @@ -209,7 +209,7 @@ # %% jupyter={"outputs_hidden": false} language="bash" # git add Wales.md -# git commit -am "Add a beacon" +# git commit -m "Add a beacon" # %% jupyter={"outputs_hidden": false} language="bash" # git log --oneline @@ -259,10 +259,12 @@ note left of P: edit Scotland.md note right of C: edit Wales.md -note left of P: git commit -am "Add scotland" +git add Scotland.md +note left of P: git commit -m "Add scotland" P->PR: create commit with Scotland file -note right of C: git commit -am "Add wales" +git add Wales.md +note right of C: git commit -m "Add wales" C->CR: create commit with Wales file note left of P: git push @@ -300,7 +302,7 @@ # %% jupyter={"outputs_hidden": false} language="bash" # git add Wales.md -# git commit -am "Add another Beacon" +# git commit -m "Add another Beacon" # git push # %% jupyter={"outputs_hidden": true} @@ -318,7 +320,7 @@ # %% jupyter={"outputs_hidden": false} magic_args="--no-raise-error" language="bash" # git add Wales.md -# git commit -am "Add Glyder" +# git commit -m "Add Glyder" # git push # %% [markdown] @@ -359,7 +361,8 @@ # Now commit the merged result: # %% jupyter={"outputs_hidden": false} language="bash" -# git commit -a --amend --no-edit # I added a No-edit for this non-interactive session. You can edit the commit if you like. +# git add Wales.md +# git commit -m "Resolve conflicts" # commit the resolved changes # %% jupyter={"outputs_hidden": false} language="bash" # git push @@ -390,10 +393,12 @@ note left of P: edit the same line in wales.md note right of C: edit the same line in wales.md -note left of P: git commit -am "update wales.md" +note left of P: git add Wales.md +note left of P: git commit -m "update wales.md" P->PR: add commit to local repo -note right of C: git commit -am "update wales.md" +note right of C: git add Wales.md +note right of C: git commit -m "update wales.md" C->CR: add commit to local repo note left of P: git push diff --git a/ch00git/10Branches.ipynb.py b/ch00git/10Branches.ipynb.py index 73fd0240..f0740ecf 100644 --- a/ch00git/10Branches.ipynb.py +++ b/ch00git/10Branches.ipynb.py @@ -48,7 +48,8 @@ * Cadair Idris # %% language="bash" -# git commit -am "Add Cadair Idris" +# git add Wales.md +# git commit -m "Add Cadair Idris" # %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} language="bash" # git switch main # Switch to an existing branch (use `checkout` if you are using git older than 2.23) @@ -140,7 +141,7 @@ # %% jupyter={"outputs_hidden": false} language="bash" # git add Scotland.md -# git commit -am "Commit Aonach onto main branch" +# git commit -m "Commit Aonach onto main branch" # %% [markdown] # Then this notation is useful to show the content of what's on what branch: diff --git a/ch00git/11Miscellany.ipynb.py b/ch00git/11Miscellany.ipynb.py index f6470aa3..ccfc324e 100644 --- a/ch00git/11Miscellany.ipynb.py +++ b/ch00git/11Miscellany.ipynb.py @@ -73,7 +73,7 @@ # %% jupyter={"outputs_hidden": false} language="bash" # git add Pennines.md -# git commit -am "Add Pennines" +# git commit -m "Add Pennines" # %% [markdown] # You can also use tag names in the place of commmit hashes, such as to list the history between particular commits: @@ -132,7 +132,7 @@ # %% jupyter={"outputs_hidden": false} language="bash" # git add Makefile # git add .gitignore -# git commit -am "Add a makefile and ignore generated files" +# git commit -m "Add a makefile and ignore generated files" # git push # %% [markdown] @@ -227,7 +227,8 @@ But has some tall hills, and maybe a mountain or two depending on your definition. # %% jupyter={"outputs_hidden": false} language="bash" -# git commit -am "Add github pages YAML frontmatter" +# git add index.md +# git commit -m "Add github pages YAML frontmatter" # %% [markdown] # ### The gh-pages branch diff --git a/ch00git/12Remotes.ipynb.py b/ch00git/12Remotes.ipynb.py index 58853db3..bca1ca24 100644 --- a/ch00git/12Remotes.ipynb.py +++ b/ch00git/12Remotes.ipynb.py @@ -55,7 +55,8 @@ * Whernside # %% jupyter={"outputs_hidden": false} language="bash" -# git commit -am "Add Whernside" +# git add Pennines.md +# git commit -m "Add Whernside" # %% jupyter={"outputs_hidden": false} language="bash" # git push -uf arc main From 4b12a2c1ba1529210ec8d35cee3943d42b93403e Mon Sep 17 00:00:00 2001 From: Saransh Chopra Date: Mon, 19 Aug 2024 14:52:11 +0100 Subject: [PATCH 4/4] Fix lesson on conflict resolution --- ch00git/04Publishing.ipynb.py | 1 - ch00git/05Collaboration.ipynb.py | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ch00git/04Publishing.ipynb.py b/ch00git/04Publishing.ipynb.py index 8ec2fd72..b6e8933f 100644 --- a/ch00git/04Publishing.ipynb.py +++ b/ch00git/04Publishing.ipynb.py @@ -125,7 +125,6 @@ # ### Git will not by default commit your new file # %% attributes={"classes": [" Bash"], "id": ""} jupyter={"outputs_hidden": false} magic_args="--no-raise-error" language="bash" -# git add lakeland.md # git commit -m "Try to add Lakeland" # %% [markdown] diff --git a/ch00git/05Collaboration.ipynb.py b/ch00git/05Collaboration.ipynb.py index 6e4c9881..5aa6220b 100644 --- a/ch00git/05Collaboration.ipynb.py +++ b/ch00git/05Collaboration.ipynb.py @@ -46,7 +46,6 @@ # %% language="bash" # pwd -# rm -rf github-example # cleanup after previous example # rm -rf partner_repo # cleanup after previous example # @@ -362,7 +361,7 @@ # %% jupyter={"outputs_hidden": false} language="bash" # git add Wales.md -# git commit -m "Resolve conflicts" # commit the resolved changes +# git commit --no-edit # I added a No-edit for this non-interactive session. You can edit the commit if you like. # %% jupyter={"outputs_hidden": false} language="bash" # git push