diff --git a/_episodes/03-create.md b/_episodes/03-create.md index 4de62fd..b7412ff 100644 --- a/_episodes/03-create.md +++ b/_episodes/03-create.md @@ -65,7 +65,7 @@ If you are using a different version of git than I am, then then the exact wording of the output might be slightly different. ~~~ -# On branch master +# On branch main # # Initial commit # diff --git a/_episodes/04-changes.md b/_episodes/04-changes.md index d4ec19d..319c17d 100644 --- a/_episodes/04-changes.md +++ b/_episodes/04-changes.md @@ -81,7 +81,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Initial commit @@ -111,7 +111,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Initial commit @@ -134,7 +134,7 @@ $ git commit -m "Start notes on the patient inflammation project" {: .bash} ~~~ -[[master (root-commit) 40b8a94] Start notes on the patient inflammation project +[[main (root-commit) 40b8a94] Start notes on the patient inflammation project 1 file changed, 1 insertion(+) create mode 100644 project.txt @@ -166,7 +166,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main nothing to commit, working tree clean ~~~ @@ -182,7 +182,7 @@ $ git log {: .bash} ~~~ -commit 40b8a9400329ed7324116cc9392dc8e4842d8501 (HEAD -> master) +commit 40b8a9400329ed7324116cc9392dc8e4842d8501 (HEAD -> main) Author: Jane Smith Date: Wed Jan 3 10:34:07 2018 +0000 @@ -235,7 +235,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) @@ -299,7 +299,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) @@ -321,7 +321,7 @@ $ git commit -m "Add note about project responsibilities" {: .bash} ~~~ -[master 71ed26a] Add note about project responsibilities +[main 71ed26a] Add note about project responsibilities 1 file changed, 2 insertions(+) ~~~ @@ -452,7 +452,7 @@ $ git commit -m "Add note about extra team members" {: .bash} ~~~ -[master 005937f] Add note about extra team members +[main 005937f] Add note about extra team members 1 file changed, 1 insertion(+) ~~~ {: .output} @@ -465,7 +465,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main nothing to commit, working directory clean ~~~ {: .output} @@ -478,7 +478,7 @@ $ git log {: .bash} ~~~ -commit 63f6bc6039c12ce897cf3f02bda1e95fd30fef58 (HEAD -> master) +commit 63f6bc6039c12ce897cf3f02bda1e95fd30fef58 (HEAD -> main) Author: Jane Smith Date: Wed Jan 3 10:42:09 2018 +0000 @@ -532,7 +532,7 @@ Date: Wed Jan 3 10:34:07 2018 +0000 > {: .bash} > > ~~~ -> commit 63f6bc6039c12ce897cf3f02bda1e95fd30fef58 (HEAD -> master) +> commit 63f6bc6039c12ce897cf3f02bda1e95fd30fef58 (HEAD -> main) > Author: Jane Smith > Date: Wed Jan 3 10:42:09 2018 +0000 > @@ -548,7 +548,7 @@ Date: Wed Jan 3 10:34:07 2018 +0000 > ~~~ > {: .bash} > ~~~ -> 63f6bc6 (HEAD -> master) Add note about extra team members +> 63f6bc6 (HEAD -> main) Add note about extra team members > 71ed26a Add note about project responsibilities > 40b8a94 Start notes on the patient inflammation project > ~~~ @@ -562,7 +562,7 @@ Date: Wed Jan 3 10:34:07 2018 +0000 > ~~~ > {: .bash} > ~~~ -> * 63f6bc6 (HEAD -> master) Add note about extra team members +> * 63f6bc6 (HEAD -> main) Add note about extra team members > * 71ed26a Add note about project responsibilities > * 40b8a94 Start notes on the patient inflammation project > ~~~ @@ -701,7 +701,7 @@ repository (`git commit`): > > ~~~ > > {: .bash} > > ~~~ -> > [master a264d5c] Add note about what data would be useful +> > [main a264d5c] Add note about what data would be useful > > 2 files changed, 3 insertions(+) > > create mode 100644 analysis.txt > > ~~~ @@ -741,7 +741,7 @@ repository (`git commit`): > > ~~~ > > {: .bash} > > ~~~ -> > [master 4162a51] Update Jane's bio. +> > [main 4162a51] Update Jane's bio. > > Author: Pete Jones > > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/_episodes/05-history.md b/_episodes/05-history.md index a17d541..f2d3aea 100644 --- a/_episodes/05-history.md +++ b/_episodes/05-history.md @@ -211,7 +211,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) @@ -271,7 +271,7 @@ $ git status {: .bash} ~~~ -# On branch master +# On branch main Changes to be committed: (use "git reset HEAD ..." to unstage) # Changes not staged for commit: @@ -305,7 +305,7 @@ $ git checkout HEAD project.txt > to revert `project.txt` to its state after the commit `f22b25e`. > If you forget `project.txt` in that command, Git will tell you that "You are in > 'detached HEAD' state." In this state, you shouldn't make any changes. -> You can fix this by reattaching your head using ``git checkout master`` +> You can fix this by reattaching your head using ``git checkout main`` {: .callout} It's important to remember that diff --git a/_episodes/06-ignore.md b/_episodes/06-ignore.md index 76b2810..b889399 100644 --- a/_episodes/06-ignore.md +++ b/_episodes/06-ignore.md @@ -30,7 +30,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Untracked files: (use "git add ..." to include in what will be committed) @@ -75,7 +75,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Untracked files: (use "git add ..." to include in what will be committed) @@ -98,7 +98,7 @@ $ git status {: .bash} ~~~ -# On branch master +# On branch main nothing to commit, working directory clean ~~~ {: .output} @@ -128,7 +128,7 @@ $ git status --ignored {: .bash} ~~~ -On branch master +On branch main Ignored files: (use "git add -f ..." to include in what will be committed) diff --git a/_episodes/07-github.md b/_episodes/07-github.md index b290f92..e22b428 100644 --- a/_episodes/07-github.md +++ b/_episodes/07-github.md @@ -24,7 +24,7 @@ on the web rather than on someone's laptop. Most programmers use hosting services like [GitHub](https://github.com), [BitBucket](https://bitbucket.org) or -[GitLab](https://gitlab.com/) to hold those master copies; we'll explore the pros +[GitLab](https://gitlab.com/) to hold those main copies; we'll explore the pros and cons of this in the final section of this lesson. Let's start by sharing the changes we've made to our current project with the @@ -109,7 +109,7 @@ Once the nickname `origin` is set up, this command will push the changes from our local repository to the repository on GitHub: ~~~ -$ git push origin master +$ git push origin main ~~~ {: .bash} @@ -121,7 +121,7 @@ Writing objects: 100% (16/16), 1.62 KiB | 1.62 MiB/s, done. Total 16 (delta 4), reused 0 (delta 0) remote: Resolving deltas: 100% (4/4), done. To https://github.com/ARCTraining/inflammation.git - * [new branch] master -> master + * [new branch] main -> main ~~~ {: .output} @@ -180,19 +180,19 @@ Our local and remote repositories are now in this state: > option is synonymous with the `--set-upstream-to` option for the `git branch` > command, and is used to associate the current branch with a remote branch so > that the `git pull` command can be used without any arguments. To do this, -> simply use `git push -u origin master` once the remote has been set up. +> simply use `git push -u origin main` once the remote has been set up. {: .callout} We can pull changes from the remote repository to the local one as well: ~~~ -$ git pull origin master +$ git pull origin main ~~~ {: .bash} ~~~ From https://github.com/ARCTraining/inflammation - * branch master -> FETCH_HEAD + * branch main -> FETCH_HEAD Already up-to-date. ~~~ diff --git a/_episodes/08-collab.md b/_episodes/08-collab.md index 1537cf5..99f8f40 100644 --- a/_episodes/08-collab.md +++ b/_episodes/08-collab.md @@ -69,7 +69,7 @@ $ git commit -m "First Python analysis script" {: .bash} ~~~ -[master 6cc98ec] First Python analysis script +[main 6cc98ec] First Python analysis script 1 file changed, 2 insertions(+) create mode 100644 code.py ~~~ @@ -78,7 +78,7 @@ create mode 100644 code.py Then push the change to the *Owner's repository* on GitHub: ~~~ -$ git push origin master +$ git push origin main ~~~ {: .bash} @@ -89,7 +89,7 @@ Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 354 bytes | 354.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To https://github.com/jane/inflammation.git - 9dba5e1..6cc98ec master -> master + 9dba5e1..6cc98ec main -> main ~~~ {: .output} @@ -104,7 +104,7 @@ Collaborator. To download the Collaborator's changes from GitHub, the Owner now enters: ~~~ -$ git pull origin master +$ git pull origin main ~~~ {: .bash} @@ -114,8 +114,8 @@ remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done. From https://github.com/ARCTraining/inflammation - * branch master -> FETCH_HEAD - 9dba5e1..6cc98ec master -> origin/master + * branch main -> FETCH_HEAD + 9dba5e1..6cc98ec main -> origin/main Updating 9dba5e1..6cc98ec Fast-forward code.py | 2 ++ @@ -133,10 +133,10 @@ GitHub) are back in sync. > repository you are collaborating on, so you should `git pull` before making > our changes. The basic collaborative workflow would be: > -> * update your local repo with `git pull origin master`, +> * update your local repo with `git pull origin main`, > * make your changes and stage them with `git add`, > * commit your changes with `git commit -m`, and -> * upload the changes to GitHub with `git push origin master` +> * upload the changes to GitHub with `git push origin main` > > It is better to make many commits with smaller changes rather than > of one commit with massive changes: small commits are easier to @@ -155,14 +155,14 @@ GitHub) are back in sync. > command line? And on GitHub? > > > ## Solution -> > On the command line, the Collaborator can use ```git fetch origin master``` +> > On the command line, the Collaborator can use ```git fetch origin main``` > > to get the remote changes into the local repository, but without merging -> > them. Then by running ```git diff master origin/master``` the Collaborator +> > them. Then by running ```git diff main origin/main``` the Collaborator > > will see the changes output in the terminal. > > > > On GitHub, the Collaborator can go to their own fork of the repository and > > look right above the light blue latest commit bar for a gray bar saying -> > "This branch is 1 commit behind Our-Repository:master." On the far right of +> > "This branch is 1 commit behind Our-Repository:main." On the far right of > > that gray bar is a Compare icon and link. On the Compare page the > > Collaborator should change the base fork to their own repository, then click > > the link in the paragraph above to "compare across forks", and finally diff --git a/_episodes/09-conflict.md b/_episodes/09-conflict.md index d9b57fd..17ab0cf 100644 --- a/_episodes/09-conflict.md +++ b/_episodes/09-conflict.md @@ -67,13 +67,13 @@ $ git commit -m "Add a line to the collaborator copy" {: .bash} ~~~ -[master f4915d6] Add a line to the collaborator copy +[main f4915d6] Add a line to the collaborator copy 1 file changed, 1 insertion(+) ~~~ {: .output} ~~~ -$ git push origin master +$ git push origin main ~~~ {: .bash} @@ -85,7 +85,7 @@ Writing objects: 100% (3/3), 333 bytes | 333.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: Resolving deltas: 100% (2/2), completed with 2 local objects. To https://github.com/ARCTraining/inflammation.git - 6cc98ec..f4915d6 master -> master + 6cc98ec..f4915d6 main -> main ~~~ {: .output} @@ -119,7 +119,7 @@ $ git commit -m "Add a line in the originator's copy" {: .bash} ~~~ -[master ef10d89] Add a line in the originator's copy +[main ef10d89] Add a line in the originator's copy 1 file changed, 1 insertion(+) ~~~ {: .output} @@ -127,13 +127,13 @@ $ git commit -m "Add a line in the originator's copy" but Git won't let us push it to GitHub: ~~~ -$ git push origin master +$ git push origin main ~~~ {: .bash} ~~~ To https://github.com/jane/inflammation.git - ! [rejected] master -> master (fetch first) + ! [rejected] main -> main (fetch first) error: failed to push some refs to 'https://github.com/jane/inflammation.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing @@ -153,7 +153,7 @@ and then push that. Let's start by pulling: ~~~ -$ git pull origin master +$ git pull origin main ~~~ {: .bash} @@ -163,8 +163,8 @@ remote: Compressing objects: 100% (1/1), done. remote: Total 3 (delta 2), reused 3 (delta 2), pack-reused 0 Unpacking objects: 100% (3/3), done. From https://github.com/jane/inflammation - * branch master -> FETCH_HEAD - 6cc98ec..f4915d6 master -> origin/master + * branch main -> FETCH_HEAD + 6cc98ec..f4915d6 main -> origin/main Auto-merging project.txt CONFLICT (content): Merge conflict in project.txt Automatic merge failed; fix conflicts and then commit the result. @@ -236,7 +236,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main All conflicts fixed but you are still merging. (use "git commit" to conclude merge) @@ -253,14 +253,14 @@ $ git commit -m "Merge changes from GitHub" {: .bash} ~~~ -[master 2abf2b1] Merge changes from GitHub +[main 2abf2b1] Merge changes from GitHub ~~~ {: .output} Now we can push our changes to GitHub: ~~~ -$ git push origin master +$ git push origin main ~~~ {: .bash} @@ -272,7 +272,7 @@ Writing objects: 100% (7/7), 755 bytes | 755.00 KiB/s, done. Total 7 (delta 4), reused 0 (delta 0) remote: Resolving deltas: 100% (4/4), completed with 3 local objects. To https://github.com/jane/inflammation.git - f4915d6..dc29981 master -> master + f4915d6..dc29981 main -> main ~~~ {: .output} @@ -281,7 +281,7 @@ so we don't have to fix things by hand again when the collaborator who made the first change pulls again: ~~~ -$ git pull origin master +$ git pull origin main ~~~ {: .bash} @@ -291,8 +291,8 @@ remote: Compressing objects: 100% (3/3), done. remote: Total 7 (delta 4), reused 7 (delta 4), pack-reused 0 Unpacking objects: 100% (7/7), done. From https://github.com/jane/inflammation - * branch master -> FETCH_HEAD - f4915d6..dc29981 master -> origin/master + * branch main -> FETCH_HEAD + f4915d6..dc29981 main -> origin/main Updating f4915d6..dc29981 Fast-forward analysis.txt | 1 + @@ -327,7 +327,7 @@ correctly. If you find yourself resolving a lot of conflicts in a project, consider these technical approaches to reducing them: - Pull from upstream more frequently, especially before starting new work -- Use topic branches to segregate work, merging to master when complete +- Use topic branches to segregate work, merging to main when complete - Make smaller more atomic commits - Where logically appropriate, break large files into smaller ones so that it is less likely that two authors will alter the same file simultaneously @@ -392,7 +392,7 @@ Conflicts can also be minimized with project management strategies: > > {: .bash} > > > > ~~~ -> > [master c769bc5] Add a chart image +> > [main c769bc5] Add a chart image > > 1 file changed, 0 insertions(+), 0 deletions(-) > > create mode 100644 chart1.jpg > > ~~~ @@ -405,13 +405,13 @@ Conflicts can also be minimized with project management strategies: > > When Jane tries to push, she gets a familiar message: > > > > ~~~ -> > $ git push origin master +> > $ git push origin main > > ~~~ > > {: .bash} > > > > ~~~ To https://github.com/jane/inflammation.git - ! [rejected] master -> master (fetch first) + ! [rejected] main -> main (fetch first) error: failed to push some refs to 'https://github.com/jane/inflammation.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing @@ -424,7 +424,7 @@ hint: See the 'Note about fast-forwards' in 'git push --help' for details. > > We've learned that we must pull first and resolve any conflicts: > > > > ~~~ -> > $ git pull origin master +> > $ git pull origin main > > ~~~ > > {: .bash} > > @@ -432,14 +432,14 @@ hint: See the 'Note about fast-forwards' in 'git push --help' for details. > > a message like this: > > > > ~~~ -> > $ git pull origin master +> > $ git pull origin main > > remote: Counting objects: 3, done. > > remote: Compressing objects: 100% (3/3), done. > > remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0 > > Unpacking objects: 100% (3/3), done. > > From https://github.com/ARCTraining/inflammation -> > * branch master -> FETCH_HEAD -> > dc29981..c769bc5 master -> origin/master +> > * branch main -> FETCH_HEAD +> > dc29981..c769bc5 main -> origin/main > > warning: Cannot merge binary files: chart1.jpg (HEAD vs. c769bc59aa612198cf77ac01a9e8f8479d7940ea) > > Auto-merging chart1.jpg > > CONFLICT (add/add): Merge conflict in chart1.jpg @@ -471,7 +471,7 @@ hint: See the 'Note about fast-forwards' in 'git push --help' for details. > > {: .bash} > > > > ~~~ -> > [master 860c242] Use the greyscale image instead of the colour one +> > [main 860c242] Use the greyscale image instead of the colour one > > ~~~ > > {: .output} > > @@ -486,7 +486,7 @@ hint: See the 'Note about fast-forwards' in 'git push --help' for details. > > {: .bash} > > > > ~~~ -> > [master da21b34] Use the colour image instead of the greyscale one +> > [main da21b34] Use the colour image instead of the greyscale one > > ~~~ > > {: .output} > > @@ -514,7 +514,7 @@ hint: See the 'Note about fast-forwards' in 'git push --help' for details. > > {: .bash} > > > > ~~~ -> >[master 6aa1183] Use two images: grey and colour +> >[main 6aa1183] Use two images: grey and colour > > 2 files changed, 0 insertions(+), 0 deletions(-) > > create mode 100644 chart1-colour.jpg > > rename chart1.jpg => chart1-grey.jpg (100%) @@ -558,11 +558,11 @@ hint: See the 'Note about fast-forwards' in 'git push --help' for details. > > > > |order|action . . . . . . |command . . . . . . . . . . . . . . . . . . . | > > |-----|-------------------|----------------------------------------------| -> > |1 | Update local | `git pull origin master` | +> > |1 | Update local | `git pull origin main` | > > |2 | Make changes | `echo 100 >> numbers.txt` | > > |3 | Stage changes | `git add numbers.txt` | > > |4 | Commit changes | `git commit -m "Add 100 to numbers.txt"` | -> > |5 | Update remote | `git push origin master` | +> > |5 | Update remote | `git push origin main` | > > |6 | Celebrate! | `AFK` | > > > {: .solution} diff --git a/_episodes/14-supplemental-rstudio.md b/_episodes/14-supplemental-rstudio.md index 99c4c6e..120f275 100644 --- a/_episodes/14-supplemental-rstudio.md +++ b/_episodes/14-supplemental-rstudio.md @@ -83,7 +83,7 @@ the history: > If this is the case, it generally means that RStudio doesn't know the > location of any other version of your repository (i.e. the one on GitHub). > To fix this, open a terminal to the repository and enter the command: -> `git push -u origin master`. Then restart RStudio. +> `git push -u origin main`. Then restart RStudio. {: .callout} If we click on "history", we can see a pretty graphical version of what diff --git a/_extras/discuss.md b/_extras/discuss.md index a2af29f..a7250fa 100644 --- a/_extras/discuss.md +++ b/_extras/discuss.md @@ -242,7 +242,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main nothing to commit, working directory clean ~~~ {: .output} @@ -257,7 +257,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Changes to be committed: (use "git reset HEAD ..." to unstage) @@ -299,7 +299,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Changes not staged for commit: (use "git add/rm ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) @@ -322,7 +322,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Changes to be committed: (use "git reset HEAD ..." to unstage) @@ -370,7 +370,7 @@ $ git status {: .bash} ~~~ -# On branch master +# On branch main # Changes to be committed: # (use "git reset HEAD ..." to unstage) # @@ -409,7 +409,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Changes not staged for commit: (use "git add/rm ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) @@ -437,7 +437,7 @@ $ git status {: .bash} ~~~ -On branch master +On branch main Changes to be committed: (use "git reset HEAD ..." to unstage) diff --git a/_extras/guide.md b/_extras/guide.md index 22b88f5..6f42f1f 100644 --- a/_extras/guide.md +++ b/_extras/guide.md @@ -146,9 +146,9 @@ working in teams or not, because it is doing `$ git checkout f22b25e mars.txt`, someone does `$ git checkout f22b25e`, they wind up in the "detached HEAD" state and confusion abounds. It's then possible to keep on committing, but things like `git push origin - master` a bit later will not give easily comprehensible results. It also + main` a bit later will not give easily comprehensible results. It also makes it look like commits can be lost. To "fix" a "detached HEAD", simply - `git checkout master`. + `git checkout main`. * This is a good moment to show a log within a Git GUI. If you skip it because you're short on time, show it once in GitHub.