Skip to content

Commit a4742e3

Browse files
committed
feat: Documentation updated.
1 parent 9d92dc8 commit a4742e3

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

Tips And Tricks/git.txt

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ Your branch: A──B──C──D──E─────────┴─M
1010
1111
Merge commit (M)
1212

13-
You branched from commit C.
14-
You added commits D and E.
15-
Upstream added commits after C.
16-
When you git merge upstream/main, Git creates a merge commit (M) joining both histories.
17-
History shows branching + merging — good for context but can look messy.
13+
You branched from commit C.
14+
You added commits D and E.
15+
Upstream added commits after C.
16+
When you git merge upstream/main, Git creates a merge commit (M) joining both histories.
17+
History shows branching + merging — good for context but can look messy.
1818

1919
2020

@@ -47,14 +47,14 @@ A──B──C──F──G──H──D'──E'
4747
4848

4949
D) When to use what
50-
Merge →
51-
If you want to preserve the “real” history (showing when branches diverged).
52-
Safer for beginners (no rewriting commits).
53-
Good for long-lived feature branches.
54-
Rebase →
55-
If you want a clean, straight line history.
56-
Preferred in open-source PR workflows.
57-
Requires confidence resolving conflicts & force-pushing.
50+
Merge →
51+
If you want to preserve the “real” history (showing when branches diverged).
52+
Safer for beginners (no rewriting commits).
53+
Good for long-lived feature branches.
54+
Rebase →
55+
If you want a clean, straight line history.
56+
Preferred in open-source PR workflows.
57+
Requires confidence resolving conflicts & force-pushing.
5858

5959
6060

@@ -75,12 +75,9 @@ git rebase upstream/main
7575
# fix conflicts if needed
7676
git push origin feature-branch --force-with-lease
7777

78-
7978
8079

8180
So: Merge = “historical diary” (records exactly what happened).
8281
Rebase = “rewrite the story” (makes it look like you developed cleanly on top).
8382

8483
85-
86-
Want me to also sketch a real-life example with commit hashes (like abc123, def456) so you can see how git log looks different between merge and rebase?

0 commit comments

Comments
 (0)