DEV Community

k v v p a
k v v p a

Posted on • Originally published at dev.to on

quick git bash shortcut tutorial

Quick tutorial about how to create an easy shortcut to Git Bash that starts in your preferred directory. This is for Windows 10 as of August 6, 2020.

Step One

Press the ⊞ Windows Key on your keyboard.

Step Two

Find Git Bash in your Applications, right-click and select Open file location.

Open file location of Gitbash

Step Three

In Windows Explorer, right-click Git Bash and select Create Shortcut.

Create shortcut by right-clicking Gitbash in your Windows Explorer

Step Four

You will get an alert stating it will be placed on the Desktop, click Yes.

Click yes on the alert, which will create a shortcut on your Desktop

Step Five

Right-click your newly created shortcut, and select Properties. Under the Shortcut tab, delete --cd-to-home from the Target section. Then in the Start In section, change the path to where you’d like Git Bash to start when you open the shortcut. For me, this looks like:

--cd-to-home has been removed from Target, preferred starting path is entered into Start in

Step Six (Optional)

Want it to Run As Administrator every time? Still under the Shortcut tab, click on Advanced , then check Run As Administrator.

(WARNING: Please do your own research about what the ramifications of running as admin are. You could cause significant irreversible damage to your system.)

Choose advanced, then select run as administrator. Please be careful when doing so, however.

Bonus

Now you can either just use the shortcut from the Desktop or, in my case, I cut the shortcut and put it in my ‘code’ directory. Then I pinned it to my taskbar (right-click, then click on Pin to taskbar )

You can now pin to taskbar or move your shortcut to somewhere else.

ko-fi

Top comments (1)

Collapse
 
andreseduardop profile image
andreseduardop

How can I modify the shortcut so that Git Bash runs a command immediately after starting?