Skip to content

Commit 6ef78db

Browse files
anacmontoyapre-commit-ci[bot]brian-rose
authored
Git Branches section edits (ProjectPythia#476)
* added note about touch command which does not work on windows and fixed typo * rewrote Complete Workflow section in Git Branches for clarity * section explaining how to set upstream branch changed the name of branch unexpectedly from branchA to newbranch. fixed this * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * changed note about touch command to match the style of other admonitions * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update `touch` note Co-authored-by: Brian Rose <[email protected]> * Update foundations/github/git-branches.md Co-authored-by: Brian Rose <[email protected]> * Update foundations/github/git-branches.md Co-authored-by: Brian Rose <[email protected]> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Brian Rose <[email protected]>
1 parent f24a3a8 commit 6ef78db

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

foundations/github/git-branches.md

+17-11
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ Before we push this branch upstream, let's make some sample changes (like C3 or
146146
touch hello.py
147147
```
148148

149+
```{admonition} Note
150+
:class: info
151+
`touch` is not a Windows native command. You can use `type nul > hello.py` to create an empty file instead.
152+
```
153+
149154
![Git Status](../../images/6-samplechange.png)
150155

151156
You can check that this file has been created by comparing an `ls` before and after this command, and also with a `git status` that will show your new untracked file.
@@ -182,7 +187,7 @@ Thankfully, Git provided this command in the previous error message. If you clon
182187

183188
We can see that this worked by doing a `git branch -a`
184189

185-
Notice the new branch called `remotes/origin/newbranch`. And when you do a `git status` you'll see that we are up to date with this new remote branch.
190+
Notice the new branch called `remotes/origin/branchA`. And when you do a `git status` you'll see that we are up to date with this new remote branch.
186191

187192
![Git Commit Status](../../images/7-github-branchandstatus.png)
188193

@@ -269,22 +274,23 @@ git pull
269274

270275
`git pull` is a combination of `git fetch` and `git merge`. That is it updates the remote tracking branches (`git fetch`) AND updates your current branch with any new commits on the remote tracking branch (`git merge`).
271276

272-
This same concept appplies to work in a team setting. Multiple authors will have their own feature branches that merge into the same Upstream Main repository via Pull Requests. It is important for each author to do regular `git pulls` to stay up to date with each other's contributions.
277+
This same concept applies to work in a team setting. Multiple authors will have their own feature branches that merge into the same Upstream Main repository via Pull Requests. It is important for each author to do regular `git pulls` to stay up to date with each other's contributions.
273278

274279
## Complete Workflow
275280

276281
All in all your Git Branching workflow should resemble this flow:
277282
![gitworkflow](../../images/gitworkflow.gif)
278283

279-
1. Forking the upstream repository
280-
1. Creating a local clone of your upstream fork
281-
1. Creating a new branch
282-
1. Switching branches
283-
1. Making a commit
284-
1. Setting up a remote branch
285-
1. Merging branches via a PR
286-
1. Deleting branches
287-
1. Pulling from upstream
284+
1. Fork the upstream repository
285+
1. Create a local clone of your upstream fork
286+
1. Create and switch to a new branch in local copy
287+
1. Make changes
288+
1. Add and commit changes in branch
289+
1. Push commits to fork (Set an upstream branch only for first push)
290+
1. Repeat last three steps as necessary
291+
1. Merge into upstream main branch via Pull Request
292+
1. Delete branch from clone and fork
293+
1. Pull upstream changes to main branch of fork and clone
288294

289295
---
290296

0 commit comments

Comments
 (0)