Skip to content

Commit

Permalink
Merge pull request #134 from taylor-a-barnes/patch-1
Browse files Browse the repository at this point in the history
Update the Git Tutorials
  • Loading branch information
janash committed Apr 4, 2024
2 parents 2422263 + 663c358 commit 51f8316
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
12 changes: 3 additions & 9 deletions _episodes/00-git-standalone.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ To return to the most recent point,
````{tab-set-code}
```{code-block} shell
git checkout main
git switch main
```
````

Expand Down Expand Up @@ -632,7 +632,7 @@ Next, commit this change:
````{tab-set-code}
```{code-block} shell
git add hello_world.py
git add quotes.py
git commit -m "add function to print Hello World"
```
````
Expand Down Expand Up @@ -700,12 +700,6 @@ Save and commit this change.

## Getting Changes to Your main Branch

This is as far as we complete in class.
Do not do the next sections if you want to follow along.

The portion below here should only be used if you are working on a project alone.
Otherwise, we will discuss how to get changes all on the same branch in the lesson on collaboration using GitHb.

To incorporate these changes in main, you will need to do a `git merge`.
When you do a merge, you should be on the branch you would like to merge into. In this case, we will first merge the changes from our `doc_update` branch, then our `hello_world` branch, so we should be on our `main` branch.
Next we will use the `git merge` command.
Expand All @@ -726,7 +720,7 @@ We can merge our `doc_update` branch to get changes from our `doc_update` branch
````{tab-set-code}
```{code-block} shell
git checkout main
git switch main
git merge doc_update
```
````
Expand Down
11 changes: 10 additions & 1 deletion _episodes/00-github-standalone.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ The third command copies (or "pushes") everything which we have tracked using gi
The word `main` means we are pushing the `main` branch.

Now if you refresh the GitHub webpage you should be able to see all of the new files you added to the repository.

## Working With Multiple Repositories

One of the most potentially frustrating problems in software development is keeping track of all the different copies of the code.
Expand Down Expand Up @@ -350,6 +351,14 @@ git pull
```
````

```{admonition} Configuring git pull
:class: note
You may get a message that says `You have divergent branches and need to specify how to reconcile them.`
In this case, execute the command `git config pull.rebase false` and then run `git pull` again.
```

You should see a message that says:

````{tab-set-code}
Expand Down Expand Up @@ -497,7 +506,7 @@ This is the end of testing.txt
````

Scroll to the bottom of the page and write the name "Added a line to testing.txt from the web interface" for this commit.
Then, click the green "Commit changes" button at the bottom left.
Then, click the green "Commit changes" button.
You should now see that your change appears in the text box.

Click the "Blame" button to find out who is responsible for each line of code.
Expand Down
10 changes: 6 additions & 4 deletions _episodes/07-collaboration.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ This will take you to some options that will help you to maintain your repositor

This page lets you do several important things including rename, relocate, transfer, or delete your repository.

Underneath the "Features" heading you will notice an option to "Restrict editing to collaborators only".
This option prevents random strangers from being able to push changes to your repository, and should always be kept on.
To allow other people to work with you, you can assign collaborators.
Click the "Manage access" tab on the left. This will bring up a page where you can see some details about your repository.
The box under the heading "Manage access" will allow you to invite collaborators to your project.
Click the “Collaborators” tab on the left
This will bring up a page where you can see some details about your repository.
The “Add people” button under the heading “Manage access” will allow you to invite collaborators to your project.

A pop-up with a search bar will appear where you can search for the names of other GitHub users.
By finding someone using the search bar and then clicking "Add collaborator", you can allow specific people to contribute to your project.
Expand All @@ -43,6 +42,7 @@ Adding them to the repository as a collaborator will allow them to push to the r
People you don't know very well shouldn't be listed as collaborators, but there are still ways for them to contribute improvements to your project.

### Protecting your main Branch

If you choose to work with collaborators, there are still ways for you to protect your code.
Click the "Branches" tab. You will see a heading that says "Branch protection rule".
Adding the name of a branch here will make it a "protected branch" and the rules you choose in the section below will protect the branch (under the heading "protect matching branches").
Expand All @@ -51,6 +51,7 @@ This way, your collaborators will not be able to push to the main branch, and mu
You can read more about [branch protection](https://help.github.com/en/enterprise/2.18/admin/developer-workflow/).

### Pull Requests - Branch and Pull Request (PR)

Protecting your main branch will require contributors to submit their changes through a process called a Pull Request.
As the repository owner, you can also change the code through a pull request on GitHub.

Expand Down Expand Up @@ -293,6 +294,7 @@ git branch -a
We will use remotes/upstream/main to keep track of new changes that happen upstream that we do not have in our local main.

## Developing a new feature - creating branches

We will implement a new element for the webpage.

Create a new branch in your repo with your element of choice.
Expand Down

0 comments on commit 51f8316

Please sign in to comment.