Go To Previous Git Branch Or Previous Directory via Terminal #OneDevMinute
Ahmad Awais ⚡️

Ahmad Awais ⚡️ @ahmadawais

About: VP of DevRel RapidAPI ❯ Award-winning Web Developer NodeCLI.com ❯ Google Dev Expert Web tech ❯ 2x GitHub Stars Award ❯ WordPress Core Dev ❯ TEDx Speaker ❯ "awesome example for devs" — Satya Nadella

Location:
San Francisco Bay Area
Joined:
Feb 19, 2017

Go To Previous Git Branch Or Previous Directory via Terminal #OneDevMinute

Publish Date: Sep 28 '18
38 6

Yet Another #OneDevMinute where you'll learn about how easy it is to access the previous git branch, and then again do the same with normal directories in your terminal.

Seriously, if you are working in two different directories or in two different git branches, then moving back and forth again and again can be pretty cumbersome. This tip sets you up with cd - or git checkout -. Watch the video to learn more.

git checkout other-branch
git checkout yet-another-branch
git checkout - # Takes you back in the other-branch
git checkout - # Takes you back in the yet-other-branch

cd dir1
cd dir2
cd - # Takes you back in the dir1
cd - # Takes you back in the dir2
Enter fullscreen mode Exit fullscreen mode

P.S. If you like my work, feel free to share it, like it. I am quite active on twitter you can find me cracking silly jokes there, maybe follow me on Twitter to connect and subscribe to my YouTube channel →
Peace! ✌️

🗣️ Comment below if you didn't get something.

Comments 6 total

  • Ben Sinclair
    Ben SinclairSep 28, 2018

    I never knew you could do that with git checkout -. That's a great tip.

    • Ahmad Awais ⚡️
      Ahmad Awais ⚡️Sep 28, 2018

      Glad you liked it. It's a silly small thing but it's super useful. 😇

  • Peter Kim Frank
    Peter Kim FrankSep 28, 2018

    I'm loving these, thanks @mrahmadawais !

  • Thomas Junkツ
    Thomas JunkツSep 29, 2018

    I love this small videobits you do. Not everytime I learn something new - although this time I really did ;) - but they are on the point and nice to watch! Keep on going!

    • Ahmad Awais ⚡️
      Ahmad Awais ⚡️Sep 29, 2018

      Glad to hear that. Your appreciation will fuel my motivation for future episodes. 👍

Add comment