https://github.com/peachtj/branchingexercise
BranchingExercise from The Git & Github Bootcamp
https://github.com/peachtj/branchingexercise
git
Last synced: about 1 month ago
JSON representation
BranchingExercise from The Git & Github Bootcamp
- Host: GitHub
- URL: https://github.com/peachtj/branchingexercise
- Owner: PeachTj
- Created: 2025-03-02T18:23:59.000Z (over 1 year ago)
- Default Branch: harry
- Last Pushed: 2025-03-02T18:41:06.000Z (over 1 year ago)
- Last Synced: 2025-03-02T19:28:32.055Z (over 1 year ago)
- Topics: git
- Homepage: https://www.udemy.com/course/git-and-github-bootcamp/learn/lecture/25115344#questions
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Git branching
## 1. Viewing Branches
Use `git branch` to view your existing branches,\Look for the * which indicates the branch you are currently on.
## 2.Creating Branches
Use `git branch ` to make a new branch based upon the current HEAD. lt does not switch you to that branch (the HEAD stays the same.
## 3.Switching Branches
Once you have created a new branch use `git switch ` to switch to it.
Use `git switch -c ` to create a new branch AND switch to it all in one go.
# Branching Exercise
1. Make a new folder called `Patronus`
2. Make a new git repo inside the folder (make sure you're not in an existing repo)
3. Create a new file called `patronus.txt` (leave it empty for now)
4. Add and commit the empty file, with the message "add empty patronus file"
5. Immediately make a new branch called `harry` and another branch called `snape` (both based on the master branch)
6. Move to the `harry` branch using the "new" command to change branches.
7. In the `patronus.txt` file, add the following:
```
HARRY'S PATRONUS
/| |\\
`__\\\\ //__'
|| ||
\\__`\\ |'__/
`_\\\\ //_'
_.,:---;,._
\\_: :_/
|@. .@|
| |
,\\.-./ \\
;;`-' `---__________-----.-.
;;; \\_\\
';;; |
; | ;
\\ \\ \\ | /
\\_, \\ / \\ |\\
|';| |,,,,,,,,/ \\ \\ \\_
| | | \\ / |
\\ \\ | | / \\ |
| || | | | | |
| || | | | | |
| || | | | | |
|_||_| |_| |_|
/_//_/ /_/ /_/
```
8. Add and commit the changes, with the commit message "add harry's stag patronus"
9. Move over to the `snape` branch using the "older" command to change branches.
10. Put the following text in the `patronus.txt` file:
````
```
SNAPE'S PATRONUS
. _,
|`\\__/ /
\\ . .(
| __T|
/ |
_.---=======' |
// {}
`| , , {}
\\ /___; ,'
) ,-;` `\\ //
| / ( ;||
||`\\\\ |||
|| \\\\ |||
)\\ )\\ )||
`" `" `""
```
````
1. Add and commit the changes on the `snape` branch with the commit message "add snape's doe patronus"
2. Next, create a new branch based upon the `snape` branch called `lily`
3. Move to the `lily` branch
4. Edit the `patronus.txt` file so that it says `LILY'S PATRONUS` at the top instead of `SNAPE'S PATRONUS` (leave the doe ascii-art alone)
5. Add and commit the change with the message "add lily's doe patronus"
6. Run a git command to list all branches (you should see 4)
7. **Bonus:** delete the `snape` branch (poor Snape)