DEV Community

Sugumar R
Sugumar R

Posted on

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

Heroku

Amplify your impact where it matters most — building exceptional apps.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • 0:56 --last-failed
  • 2:34 --only-changed
  • 4:27 --repeat-each
  • 5:15 --forbid-only
  • 5:51 --ui --headed --workers 1

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Click on any timestamp above to jump directly to that section in the tutorial!

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay