GIT DAY 4

`git rebase Used to move or rewrite commits from one branch onto another. Helps keep a cleaner commit history compared to git merge. Example: sh git checkout feature-branch git rebase main This applies all commits from feature-branch on top of main, making it look like they were developed in sequence. git stash Temporarily saves your local changes without committing them. Useful when you need to switch branches but don’t want to commit unfinished work. Example: sh git stash This saves your changes and resets the working directory. 3. git stash pop Retrieves the last stashed changes and applies them back to your working directory. Example: sh git stash pop Unlike git stash apply, pop also removes the stash after applying it. Would you like an example scenario combining these? Or are you looking for a more video-style explanation?

Mar 21, 2025 - 18:03
 0
GIT DAY 4
  1. `git rebase
  • Used to move or rewrite commits from one branch onto another.
  • Helps keep a cleaner commit history compared to git merge.
  • Example: sh git checkout feature-branch git rebase main
  • This applies all commits from feature-branch on top of main, making it look like they were developed in sequence.
  1. git stash
    • Temporarily saves your local changes without committing them.
    • Useful when you need to switch branches but don’t want to commit unfinished work.
    • Example: sh git stash
    • This saves your changes and resets the working directory.

3. git stash pop

  • Retrieves the last stashed changes and applies them back to your working directory.
  • Example: sh git stash pop
  • Unlike git stash apply, pop also removes the stash after applying it.

Would you like an example scenario combining these? Or are you looking for a more video-style explanation?