Ravindra BagaleCourses & study guides मराठी

Ravi Sir's Cards › DevOps

Chapter 3: Branch, Merge, Rebase, Stash and Pull Requests: Cards

मराठी cards · Open the chapter

Revision cards

Why branches. Two people changing the same code at the same time break each other's work.
Revision card 1 of 15: Why branches · Download PNG · Open card page

Lesson: 3.1 Why branches — two developers, one shared app

Branch: create, switch, list, delete. You need to move between tasks quickly and keep branches tidy.
Revision card 2 of 15: Branch: create, switch, list, delete · Download PNG · Open card page

Lesson: 3.2 branch, switch, list, delete

Feature branch workflow: the daily loop. Teams need one simple habit so nobody breaks main.
Revision card 3 of 15: Feature branch workflow: the daily loop · Download PNG · Open card page

Lesson: 3.3 Feature-branch workflow (the daily loop)

Git fetch vs pull vs push. Git keeps a copy of the code on your PC and one on GitHub (online). They go out of date, so you sync them.
Revision card 4 of 15: Git fetch vs pull vs push · Download PNG · Open card page

Lesson: 3.4 Fetch vs pull vs push

Fork, upstream and the pull request. You can't push to someone else's repo directly.
Revision card 5 of 15: Fork, upstream and the pull request · Download PNG · Open card page

Lesson: 3.5 Fork, upstream, and the pull request

Merge: fast-forward and merge commit. You must know what merge will do to history before you run it.
Revision card 6 of 15: Merge: fast-forward and merge commit · Download PNG · Open card page

Lesson: 3.6 Merge — fast-forward and a merge commit

A conflict, line by line. Git can't guess which of two edits to the same line is right.
Revision card 7 of 15: A conflict, line by line · Download PNG · Open card page

Lesson: 3.7 A conflict, line by line

Rebase: when safe, when to merge instead. A messy history is hard to read, but rewriting shared history breaks teammates.
Revision card 8 of 15: Rebase: when safe, when to merge instead · Download PNG · Open card page

Lesson: 3.8 Rebase when it is safe — and when to merge instead

Stash: park unfinished work. Sometimes you must switch branch now, but your work is not ready to commit.
Revision card 9 of 15: Stash: park unfinished work · Download PNG · Open card page

Lesson: 3.9 Stash — park the unfinished edit

Cherry-pick one commit. Sometimes you need one fix, not a whole branch.
Revision card 10 of 15: Cherry-pick one commit · Download PNG · Open card page

Lesson: 3.10 Cherry-pick one commit

Reset: soft, mixed and hard. You will want to undo commits, but some undos lose work.
Revision card 11 of 15: Reset: soft, mixed and hard · Download PNG · Open card page

Lesson: 3.11 reset --soft, --mixed and --hard

log --graph, diff and show. Before merging or fixing, you must see what happened.
Revision card 12 of 15: log --graph, diff and show · Download PNG · Open card page

Lesson: 3.12 log --graph, diff and show

Annotated tags. Teams need a fixed name for the exact code of each release.
Revision card 13 of 15: Annotated tags · Download PNG · Open card page

Lesson: 3.13 Annotated tags

Common pull request mistakes. Big unclear PRs get slow reviews and hide bugs.
Revision card 14 of 15: Common pull request mistakes · Download PNG · Open card page

Lesson: 3.14 Common pull-request mistakes

Lab: one conflict, one stash. Conflicts and stash scare beginners until they practise once.
Revision card 15 of 15: Lab: one conflict, one stash · Download PNG · Open card page

Lesson: 3.15 Lab — colour, one conflict, one stash

Interview cards

Why do teams use branches? So each task is built apart from main. Main stays working, and changes join after review.
Interview card 1 of 15: Why do teams use branches? · Download PNG · Open card page

Lesson: 3.1 Why branches — two developers, one shared app

How do you create and move to a new branch? git switch -c name creates it and moves you there. Older way: git checkout -b name.
Interview card 2 of 15: How do you create and move to a new branch? · Download PNG · Open card page

Lesson: 3.2 branch, switch, list, delete

Describe your daily Git workflow. Pull main, make a feature branch, commit small, push, open a PR, pass checks, merge, delete branch.
Interview card 3 of 15: Describe your daily Git workflow. · Download PNG · Open card page

Lesson: 3.3 Feature-branch workflow (the daily loop)

What is the difference between git fetch and git pull? fetch downloads new commits but doesn't change your files. pull = fetch + merge into your branch.
Interview card 4 of 15: What is the difference between git fetch and git pull? · Download PNG · Open card page

Lesson: 3.4 Fetch vs pull vs push

What is a fork, and what is upstream? A fork is your copy of someone's repo. upstream is the remote name for the original.
Interview card 5 of 15: What is a fork, and what is upstream? · Download PNG · Open card page

Lesson: 3.5 Fork, upstream, and the pull request

What is a fast-forward merge? If main has no new commits, Git just moves main forward to your branch's tip. No merge commit.
Interview card 6 of 15: What is a fast-forward merge? · Download PNG · Open card page

Lesson: 3.6 Merge — fast-forward and a merge commit

How do you resolve a merge conflict? Open the file, choose the correct text, remove the markers, git add, commit. Then run tests.
Interview card 7 of 15: How do you resolve a merge conflict? · Download PNG · Open card page

Lesson: 3.7 A conflict, line by line

Git merge vs rebase: which one do you use, and when? Git saves the history of code changes as commits. To bring main-branch changes into your branch:Merge joins the two histories and adds one extra “merge commit”.Rebase replays your commits on top of the latest main, so history is one straight line.
Interview card 8 of 15: Git merge vs rebase: which one do you use, and when? · Download PNG · Open card page

Lesson: 3.8 Rebase when it is safe — and when to merge instead

When do you use git stash? When you must switch branch now but your work isn't ready to commit. Stash saves it; pop brings it back.
Interview card 9 of 15: When do you use git stash? · Download PNG · Open card page

Lesson: 3.9 Stash — park the unfinished edit

What is cherry-pick used for? Copying one commit to another branch, like a hotfix onto a release branch.
Interview card 10 of 15: What is cherry-pick used for? · Download PNG · Open card page

Lesson: 3.10 Cherry-pick one commit

Explain git reset --soft, --mixed and --hard. All move the branch back. soft: changes stay staged. mixed: changes stay, unstaged. hard: changes deleted.
Interview card 11 of 15: Explain git reset --soft, --mixed and --hard. · Download PNG · Open card page

Lesson: 3.11 reset --soft, --mixed and --hard

How do you see what changed in a commit? git show COMMIT for one commit, git diff for current changes, git log --graph for history.
Interview card 12 of 15: How do you see what changed in a commit? · Download PNG · Open card page

Lesson: 3.12 log --graph, diff and show

Why use annotated tags for releases? They store author, date and message, and mark the exact commit of a release.
Interview card 13 of 15: Why use annotated tags for releases? · Download PNG · Open card page

Lesson: 3.13 Annotated tags

What makes a good pull request? Small, one task, clear title and description (what, why, how tested), and green checks.
Interview card 14 of 15: What makes a good pull request? · Download PNG · Open card page

Lesson: 3.14 Common pull-request mistakes

Have you resolved a conflict and used stash yourself? Yes: I made two branches edit the same line, merged, fixed the conflict, and practised stash and pop.
Interview card 15 of 15: Have you resolved a conflict and used stash yourself? · Download PNG · Open card page

Lesson: 3.15 Lab — colour, one conflict, one stash

Comparison cards

Merge vs Rebase. Two ways to bring changes from one branch into another.Merge: joins histories with a merge commit.Rebase: replays your commits on top.
Comparison card 1 of 3: Merge vs Rebase · Download PNG · Open card page

Lesson: 3.6 Merge — fast-forward and a merge commit

git reset vs git revert. reset: moves the branch back, removing commits.revert: adds a new commit that undoes an old one.
Comparison card 2 of 3: git reset vs git revert · Download PNG · Open card page

Lesson: 3.11 reset --soft, --mixed and --hard

git stash vs a WIP commit. Stash: save changes on a hidden shelf.WIP commit: commit unfinished work on your branch.
Comparison card 3 of 3: git stash vs a WIP commit · Download PNG · Open card page

Lesson: 3.9 Stash — park the unfinished edit