-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbranch.bat
More file actions
44 lines (31 loc) · 802 Bytes
/
Copy pathbranch.bat
File metadata and controls
44 lines (31 loc) · 802 Bytes
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
@echo off
cls
For /f "tokens=1-3 delims=. " %%a in ('date /t') do (set currentdate=%%c-%%b-%%a)
For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set currenttime=%%a:%%b)
set BRANCH=newbranch
git rev-parse --verify %BRANCH%
IF %ERRORLEVEL% NEQ 0 (
echo %BRANCH% does not exist
:: create a new branch
git branch %BRANCH%
)
git log --oneline --decorate
:: switch to new branch
git checkout %BRANCH%
git status
set TL=timeline.txt
(
echo echo Time %currentdate% %currenttime%
)>>%TL%
git add %TL%
git commit -m "Commit to branch %newbranch% %currentdate% %currenttime%"
:: switch to master branch
git checkout master
:: merge changes from new branch
echo Merge %BRANCH%
git merge %BRANCH%
IF %ERRORLEVEL% == 0 (
:: delete the new branch
echo Delete %BRANCH%
git branch -d %BRANCH%
)