githubschool / githubschool/tiger-king
Parking Lot
- Dominant language
- HTML
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Post any questions you may have here during the training.
**Tips** Don't forget there are resources on the README file of this repository!
## Links
[GitHub Flow](https://guides.github.com/introduction/flow/)
[WIP probot](https://probot.github.io/apps/wip/)
[CODEOWNERS file](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners)
## Common git commands

## GitHub Flow that shows two environments (sorry for the crappy visual)

## Day to Day Basic Workflow
1. Assuming this repository has already been cloned, now you need to bring in new updates from GitHub to incorporate work that has been done by your team
2. Make sure you're on the master branch - `git checkout master`
3. Bring in updates on GitHub with `git pull`
4. Now you can bring those updates down to your local feature branch (assuming you already have one, and have started working on it) with a reverse merge -
```
git checkout feature-branch
git merge master
```
5. You _may_ have to deal with merge conflicts. Not a bad thing! Just resolve them and move on 🥳
## Merge conflicts

Try the following exercise and take note of your observations:
1. Create a new folder
2. Make it a git repo with the command `git init`
3. Create a new file with `touch file1.txt` and add a line of text to it
4. Save, `git add`, `git commit -m`
ℹ️ For now, we are going to rule out branch protection settings & pushing to GitHub
**Exercise 1**
1. Create a new branch, and name it say, "branch1"
2. Edit `file1.txt` at the same line
3. Save and commit the change
4. Merge the branches with `git checkout master` and `git merge branch1`. This merges `branch1` into `master`.
5. What type of merge is this? Did it cause a merge conflict? Why or why not?
**Answer**
- It's a fast forward merge
- It does not cause a merge conflict even though the same line has been edited. Because `master` has not diverged from `branch1`
**Exercise 2**
1. Continue with the last exercise.
2. Let's add another line to `file1.txt`, say on line 2
3. Save and commit the change
4. Go back to `master` branch with `git checkout master`
5. Add a different text for line 2
6. Save and commit the change
7. Merge `branch1` into master again with `git merge branch1`
What happens this time?
**Answer**
- This is a merge commit. When 2 branches have diverged, they merge with the merge commit strategy.
- This causes a conflict if it touches the same line because the branches have diverged
## Revert
The question asked during the class was: What if you revert a file that has a conflicting line of code with a previous commit?
> A revert undoes everything you did in that single commit. So it will undo that line of code, and return to the previous line of code in the previous commit.
To demonstrate what I mean, you can try it out:
1. Create a repository with `git init`
2. Create a file and add line 1, save and commit, let's call this commit1
3. Open the file again and change line 1, save and commit, let's call this commit2
4. Revert commit2.
5. Notice how your file shows the line you had in commit1
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.