Day 5: Git Stash, Rebase and Cherr-pick

Recap of Day 4 Git Merge – Combining changes from one branch to another. Git Switch – Switching between branches easily. Git Branch – Creating and managing branches in a repository. Today's Learning: Git Sash,Rebase, and Cherry-Pick step 1: 1.open your project folder(bankaccound) .git file 1..git local and remout connect point. 2.right click open terminal. step 2: 1.Checking available branches comand:-> git branch this a command list all branch: $ main (default branch) $ indian-bank $ sbi-bank 2.Creating and switching to a new branch. command:-> git checkout -b RBI $This creates a new branch named RBI and switches to it. 3.Trying to use incorrect command mistake guys comand:-git Governor $ here,you mistakenly typed git Governor,but Governor is no a git comand. $ Git showed error message. 4.Creating a new file command:-> touch file names $ This comand creates an empty file names 5.Adding the file to the staging area command:-> git add . 6.Checking the git status command:-> git status $This shows the current state of your working directry. 7.Using git stash ** command:-> **git stash $ This temprorily saves(stashes) your changes and cleans your working directory. $ ->>Your changes not lost.but they are stored in a hidden area. step 3: 1.Listing stashed changes command:-> git stash list $ This shows a list of saved (stashed) changes. $ you stash all files list files. 2.Applying and Removing a specific stash command:-> git stash pop 1 $ This applies the changes from **stash@{1} and remove the stash list. 3.using an incorrect command $ git pop is not valid command. 4.Applying and removing another stash command:-> git stash pop 0 $ This applies the changes from **stash@{0} and removes them stash list. step 4: 1.staging and committing changes $ git stash pop 0 - all files stash area removing. command:-> git add . -> **git commit -m"Rbi files update". 2.Rebasing RBI Branch with main command:-> git rebase main $ This applies all the chenges from the main branch to the RBI branch. 3.Switching to the main branch command:-> git checkout main $ This switching to the main branch. 4.Rebasing main with RBI command:-> git rebase RBI step 5: 1.Two files add and commit and main branch. 2.git log shwos commit history with details. 3.copy commit id. 4.git cherry-pick This applies the commit id (paste) the current branch. Add and commit git log all history Cherry-picking commits

Mar 23, 2025 - 12:30
 0
Day 5: Git Stash, Rebase and Cherr-pick

Recap of Day 4

Git Merge – Combining changes from one branch to another.

Git Switch – Switching between branches easily.

Git Branch – Creating and managing branches in a repository.

Today's Learning: Git Sash,Rebase, and Cherry-Pick

step 1:

1.open your project folder(bankaccound)

Image description

.git file

1..git local and remout connect point.
2.right click open terminal.

Image description

step 2:

1.Checking available branches

comand:-> git branch

this a command list all branch:
$ main (default branch)
$ indian-bank
$ sbi-bank

2.Creating and switching to a new branch.
command:-> git checkout -b RBI
$This creates a new branch named RBI and switches to it.

3.Trying to use incorrect command mistake guys
comand:-git Governor
$ here,you mistakenly typed git Governor,but Governor is no a git comand.
$ Git showed error message.

4.Creating a new file
command:-> touch file names
$ This comand creates an empty file names

5.Adding the file to the staging area
command:-> git add .

6.Checking the git status
command:-> git status
$This shows the current state of your working directry.

7.Using git stash **
command:-> **git stash

$ This temprorily saves(stashes) your changes and cleans your working directory.
$ ->>Your changes not lost.but they are stored in a hidden area.

Image description

step 3:

1.Listing stashed changes

command:-> git stash list
$ This shows a list of saved (stashed) changes.
$ you stash all files list files.

2.Applying and Removing a specific stash

command:-> git stash pop 1
$ This applies the changes from **stash@{1} and remove the stash list.

3.using an incorrect command
$ git pop is not valid command.

4.Applying and removing another stash

command:-> git stash pop 0
$ This applies the changes from **stash@{0} and removes them stash list.

Image description

step 4:

1.staging and committing changes
$ git stash pop 0 - all files stash area removing.
command:-> git add .
-> **git commit -m"Rbi files update".

2.Rebasing RBI Branch with main

command:-> git rebase main
$ This applies all the chenges from the main branch to the RBI branch.

3.Switching to the main branch

command:-> git checkout main
$ This switching to the main branch.

4.Rebasing main with RBI

command:-> git rebase RBI

Image description

step 5:

1.Two files add and commit and main branch.
2.git log shwos commit history with details.
3.copy commit id.
4.git cherry-pick This applies the commit id (paste) the current branch.

Add and commit
Image description

git log all history

Image description

Cherry-picking commits

Image description