Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions Tips And Tricks/git.txt → Tips And Tricks/Git merge or rebase.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Nice — here’s the commit graph diagram you asked for. This shows how your history looks depending on whether you merge or rebase.
This shows how your history looks depending on whether you merge or rebase.


Expand All @@ -10,11 +10,11 @@ Your branch: A──B──C──D──E─────────┴─M
Merge commit (M)

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


Expand Down Expand Up @@ -47,14 +47,14 @@ A──B──C──F──G──H──D'──E'

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


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



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


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?
18 changes: 9 additions & 9 deletions Tips And Tricks/Jar File Java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ metadata into a single file.
A JAR makes it easy to distribute Java libraries, applications, and resources as one portable unit.

Key characteristics:
• ZIP-based archive (.jar).
• Contains compiled .class files, resource files (properties, images), and an optional META-INF/MANIFEST.MF.
• Can be executed (if it contains a Main-Class entry in the manifest) or used as a library on the classpath.
• ZIP-based archive (.jar).
• Contains compiled .class files, resource files (properties, images), and an optional META-INF/MANIFEST.MF.
• Can be executed (if it contains a Main-Class entry in the manifest) or used as a library on the classpath.

Why JAR files are important
• Distribution — package everything needed (classes + resources) into one file for easy sharing and deployment.
• Reproducibility — stable artifact that can be versioned and archived.
• Classpath management — simplifies dependency handling (one file instead of many loose class files).
• Security & Integrity — supports signing (JAR signing) and manifest metadata.
• Performance — fewer filesystem entries and easier I/O handling; commonly used by class loaders.
• Tooling compatibility — all build tools (Maven, Gradle, Ant), application servers, and the JVM understand JARs.
• Distribution — package everything needed (classes + resources) into one file for easy sharing and deployment.
• Reproducibility — stable artifact that can be versioned and archived.
• Classpath management — simplifies dependency handling (one file instead of many loose class files).
• Security & Integrity — supports signing (JAR signing) and manifest metadata.
• Performance — fewer filesystem entries and easier I/O handling; commonly used by class loaders.
• Tooling compatibility — all build tools (Maven, Gradle, Ant), application servers, and the JVM understand JARs.

Basic JAR layout

Expand Down