CMD open git

Source: Internet
Author: User

Once your git installation is successful and the installation is not optional you can use the CMD Black window to open it, then it will be troublesome for you to set it up again, I would say no.

Today I share a good way for my colleagues to share with me.

This method relies on a Dos file (. bat file), and we can create a file of the name you want, such as: Git_route.bat

Then you can use the editor to open, enter some of the commands you want, as follows is the contents of my Git_route.bat file:

Red Place everyone is not the same, their own actual situation in accordance with the changes.

@echo Off@rem ==============================================================================:menuclscd D:echo. echo              ================ Git Local repository path Select ================== echo. Echo                       1:    own Project Echo                       2:    H5   Echo                       3:    compass-project  echo                       4:    yeoman-project   echo. Echo                       P:    open git graphical operator interface echo                       Q:    exit echo. Echo              ================ Git Local repository path select ================== echo.

Select the git path for the code that corresponds to the set/p input= input:
If "%input%" = = "1" goto route_1
If "%input%" = = "2" goto route_2
If "%input%" = = "3" goto Route_3
If "%input%" = = "4" goto Route_4
"D:\Program files\git\bin\wish.exe" "D:\Program Files\git\libexec\git-core\git-gui"
"D:\Program files\git\bin\wish.exe" "D:\Program Files\git\libexec\git-core\git-gui"
If "%input%" = = "Q" exit
If "%input%" = = "Q" exit
Goto Menu
@rem ==============================================================================
: Route_1
D:\sites\self-project\
"D:\Program files\git\bin\sh.exe" --login-i
Goto Menu
@rem ==============================================================================
: route_2
D:\sites\H5\
"D:\Program Files (x86) \git\bin\sh.exe" --login-i
Goto Menu
@rem ==============================================================================
: Route_3
D:\sites\compass-project\
"D:\Program files\git\bin\sh.exe" --login-i
Goto Menu
@rem ==============================================================================
: Route_4
D:\sites\yeoman-project\
"D:\Program files\git\bin\sh.exe" --login-i
Goto Menu

( Note that you need to enclose the path in double quotation marks when there are spaces in the path, otherwise the command will not be valid )

Then we can double click on this file and it will open the command line in CMD's black window, as follows:

Then we enter 1, the return will be entered into the folder of the Git repository of its own project, the effect is as follows:

The entries and the others are all configured in the Git_route.bat file.

Other commands:

Enter p to enter the Git UI operator interface.

Entering exit will return to the menu interface.

Of course, at present, I am not satisfied, I put things there, I need to go where to double-click Open this file, personal expression does not like, although you can create desktop shortcuts, or locked into the taskbar below.

At the time, I wanted to be a little bit easier, and that was to open with a command.

The steps are as follows:

1, in the desktop or a directory to create a file, the Git_route.bat file just put in.

2, put the path of the folder into the environment variable inside, so that, we open the CMD Black window, directly enter the Git_route command, you can enter the Git menu interface.

CMD open git

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.