What is Git Rebase?
Git rebase command allows you to apply changes from one branch onto another.
When Should You Use git rebase?
. Updating Your Feature Branch
. Maintaining a Clean Commit History
. Resolving Conflicts Before Merge
Summary of Common Commands:
1 Start rebase: git rebase
2 Continue after resolving conflicts: git rebase --continue
3 Skip a commit during rebase: git rebase --skip
4 Abort rebase: git rebase --abort
What is git stash?
.In Git, git stash is a useful command that temporarily saves changes you’ve made in your working directory but don’t want to commit yet.
How to Use git stash
. Stash your changes:
Simply run the following command to stash all changes (both staged and unstaged):
git stash
View your stashes:
You can list all the stashes you've saved with:
git stash list
This will show a list of stashes, like stash@{0}, stash@{1}, etc.
Apply a stash:
To retrieve the most recent stash, you can apply it with:
git stash apply
You can also apply a specific stash by referencing its index, such as stash@{1}:
git stash apply stash@{1}
Pop a stash:
If you want to apply the stash and remove it from the stash list, use:
git stash pop
Drop a stash:
If you no longer need a specific stash, you can delete it:
git stash drop stash@{0}
To clear all stashes:
. git stash clear
git stash is incredibly versatile and provides a way to keep your working directory clean while ensuring that none of your changes are lost. It’s a must-have in your Git toolbox!
What is git log?
Git’s commit history is one of its most powerful features, allowing developers to trace the changes made to a repository over time.
COMMON USE CASES OF GIT LOG:
. Reviewing commit history: The git log command helps you track the history of your project, showing what changes were made, who made them, and when.
. Finding specific commits: When you're trying to locate a particular change or a bug introduced in the history, git log allows you to find commits based on time, author, or commit message.
Comparing branches: By examining the log of different branches, you can understand what changes have been made in each branch and how they differ.