31/100 Git Stash
The Nautilus application development team was working on a git repository /usr/src/kodekloudrepos/blog
present on Storage server
in Stratos DC
. One of the developers stashed some in-progress changes in this repository, but now they want to restore some of the stashed changes.
Look for the stashed changes under /usr/src/kodekloudrepos/blog
git repository, and restore the stash with stash@{1}
identifier. Further, commit and push your changes to the origin.
ssh natasha@ststor01
sudo su -
cd /usr/src/kodekloudrepos/blog
[root@ststor01 blog]# git stash list
stash@{0}: WIP on master: 110e39b initial commit
stash@{1}: WIP on master: 110e39b initial commit
[root@ststor01 blog]# git stash apply stash@{1}
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: welcome.txt
[root@ststor01 blog]# git commit -m "apply stash1"
[master 640ce3c] apply stash1
1 file changed, 1 insertion(+)
create mode 100644 welcome.txt
[root@ststor01 blog]# git push origin master
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 304 bytes | 304.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To /opt/blog.git
110e39b..640ce3c master -> master