-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitchgit.bat
More file actions
53 lines (48 loc) · 1.34 KB
/
Copy pathswitchgit.bat
File metadata and controls
53 lines (48 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
@ECHO OFF
SET PN=please set your personal user.name here
SET PM=please set your personal user.email here
SET WPN=please set your workplace user.name here
SET WPM=please set your workplace user.email here
ECHO =======================================
ECHO Your Current Git Name:
git config user.name
ECHO Your Current Git Email:
git config user.email
ECHO =======================================
ECHO Options
ECHO =======================================
ECHO 1.) Personal: %PN%
ECHO 2.) Workplace: %WPN%
ECHO =======================================
SET /P ENV="Choose an option(1 or 2):"
2>NUL CALL :CASE_%ENV%
IF ERRORLEVEL 1 CALL :DEFAULT_CASE
ECHO Done.
EXIT /B
:CASE_1
git config --global user.name "%PN%"
git config --global user.email "%PM%"
ECHO =======================================
ECHO Your have switched to:
git config user.name
git config user.email
ECHO =======================================
PAUSE
GOTO END_CASE
:CASE_2
git config --global user.name "%WPN%"
git config --global user.email "%WPM%"
ECHO =======================================
ECHO Your have switched to:
git config user.name
git config user.email
ECHO =======================================
PAUSE
GOTO END_CASE
:DEFAULT_CASE
ECHO InValid options "%ENV%"
PAUSE
GOTO END_CASE
:END_CASE
VER > NUL # reset ERRORLEVEL
GOTO :EOF # return from CALL