Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make git commands work #244

Merged
merged 5 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions ch00git/02Solo.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
6 changes: 4 additions & 2 deletions ch00git/03Mistakes.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions ch00git/04Publishing.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
# ### 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 commit -m "Try to add Lakeland"

# %% [markdown]
# This didn't do anything, because we've not told git to track the new file yet.
Expand All @@ -135,7 +135,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.
Expand Down Expand Up @@ -184,7 +184,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
Expand All @@ -208,7 +209,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

Expand Down
29 changes: 19 additions & 10 deletions ch00git/05Collaboration.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

# %% language="bash"
# pwd
# rm -rf github-example # cleanup after previous example
# rm -rf partner_repo # cleanup after previous example
#

Expand Down Expand Up @@ -114,6 +113,7 @@
==================

* Ben Eighe
* Ben Nevis
* Cairngorm

# %% jupyter={"outputs_hidden": false} language="bash"
Expand Down Expand Up @@ -188,7 +188,8 @@
# git diff

# %% jupyter={"outputs_hidden": false} language="bash"
# git commit -am "Translating from the Welsh"
# git add Wales.md
# git commit -m "Translating from the Welsh"

# %% jupyter={"outputs_hidden": false} language="bash"
# git log --oneline
Expand All @@ -206,7 +207,8 @@
* Snowdon

# %% jupyter={"outputs_hidden": false} language="bash"
# git commit -am "Add a beacon"
# git add Wales.md
# git commit -m "Add a beacon"

# %% jupyter={"outputs_hidden": false} language="bash"
# git log --oneline
Expand Down Expand Up @@ -256,10 +258,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
Expand Down Expand Up @@ -296,7 +300,8 @@
* Fan y Big

# %% jupyter={"outputs_hidden": false} language="bash"
# git commit -am "Add another Beacon"
# git add Wales.md
# git commit -m "Add another Beacon"
# git push

# %% jupyter={"outputs_hidden": true}
Expand All @@ -313,7 +318,8 @@
* Glyder Fawr

# %% jupyter={"outputs_hidden": false} magic_args="--no-raise-error" language="bash"
# git commit -am "Add Glyder"
# git add Wales.md
# git commit -m "Add Glyder"
# git push

# %% [markdown]
Expand Down Expand Up @@ -354,7 +360,8 @@
# 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 add Wales.md
# 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
Expand Down Expand Up @@ -385,10 +392,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
Expand Down
6 changes: 4 additions & 2 deletions ch00git/10Branches.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -139,7 +140,8 @@
# git diff Scotland.md

# %% jupyter={"outputs_hidden": false} language="bash"
# git commit -am "Commit Aonach onto main branch"
# git add Scotland.md
# git commit -m "Commit Aonach onto main branch"

# %% [markdown]
# Then this notation is useful to show the content of what's on what branch:
Expand Down
9 changes: 6 additions & 3 deletions ch00git/11Miscellany.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 on the remote origin
# git push --tags

# %% jupyter={"outputs_hidden": false}
Expand All @@ -68,10 +69,11 @@
========================

* Cross Fell
* Ingleborough

# %% 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:
Expand Down Expand Up @@ -130,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]
Expand Down Expand Up @@ -225,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
Expand Down
3 changes: 2 additions & 1 deletion ch00git/12Remotes.ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down