You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: commit-on-wrong-branch/README.md
+17-11Lines changed: 17 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,23 @@
1
1
# gitkatas
2
-
## Setup:
2
+
3
+
## Setup
3
4
4
5
1. Run `source setup.sh` (or `.\setup.ps1` in PowerShell)
5
6
6
7
## Kata 5: Commit on wrong branch
8
+
7
9
This kata was shameless ripped off from [Git Katas](http://blog.schauderhaft.de/gitkata/)
8
10
9
-
You are working really hard on the master branch.
11
+
You are working really hard on the master branch.
10
12
Part of your work is already committed. This is when your boss comes in with an urgent request.
11
13
12
14
Since your current HEAD is not ready for prime time you backup one commit, and start a new branch named 'quickfix'. You do whatever your boss wants and commit the changes to that new branch.
13
15
14
16
That's when you realize you created a minor mess with your branches.
15
17
16
18
Currently your commits look like this
17
-
```
19
+
20
+
```text
18
21
master
19
22
|
20
23
v
@@ -25,8 +28,10 @@ remote ^
25
28
|
26
29
quickfix
27
30
```
31
+
28
32
But you want it to look like this:
29
-
```
33
+
34
+
```text
30
35
remote
31
36
|
32
37
v
@@ -38,19 +43,20 @@ But you want it to look like this:
38
43
39
44
Git ahead!
40
45
41
-
Note: since the B in the current and in the target structure don't have the same parent they can't be literally the same commit.
46
+
Note: since the `B` in the current and in the target structure don't have the same parent they can't be literally the same commit.
42
47
43
48
## The task
44
49
45
50
1. Use `git log --oneline --graph --all` to view all the branches and their commits.
46
-
2. Copy C onto master before B by rebasing quickfix on master.
47
-
3. Make a new branch (changes-including-B) off of our master so we can keep working on B.
48
-
4. Reset the HEAD on master back to C.
49
-
5. Delete the quickfix branch.
50
-
6. Push master. You can't do this in the training exercise.
51
-
7. You can merge the changes-including-B branch to master and delete changes-including-B or just checkout changes-including-B and work there.
51
+
2. Copy `C` onto `master` before `B` by rebasing `quickfix` on `master`.
52
+
3. Make a new branch (`changes-including-B`) off of our `master` so we can keep working on `B`.
53
+
4. Reset `master` back to `C`.
54
+
5. Delete the `quickfix` branch.
55
+
6. Push `master`. You can't do this in the training exercise.
56
+
7. You can merge the `changes-including-B` branch to `master` and delete `changes-including-B` or just switch to `changes-including-B` and work there.
Copy file name to clipboardExpand all lines: ff-merge/README.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
# Git Kata: Fast-forward Merge
2
-
## Setup:
2
+
3
+
## Setup
3
4
4
5
1. Run `source setup.sh` (or `.\setup.ps1` in PowerShell)
5
6
@@ -15,16 +16,17 @@ You again live in your own branch, this time we will be doing a bit of juggling
15
16
6. What is the output of `git branch`?
16
17
7. What is the output of `git log --oneline --graph --all`
17
18
18
-
*Remember: you want to pull in the commit on the feature branch into master. The command 'git merge [branch name]' takes one branch as argument from which it takes commits. The commits are applied to the branch pointed to by HEAD (currently checked out branch).*
19
+
*Remember: you want to pull in the commit on the feature branch into master. The command 'git merge [branch name]' takes one branch as argument from which it takes commits. The commits are applied to the branch pointed to by HEAD (currently checked out branch).*
19
20
20
21
8. Checkout `master` branch
21
-
9.Use `cat` to see the contents of the greetings
22
+
9. Use `cat` to see the contents of the greetings
22
23
10. Diff the branches
23
24
11. Merge the branches
24
25
12. Use `cat` to see the contents of the greetings
0 commit comments