As a programmer, working always use some tool, and often some of their own development tool. My game, my turf, my rules. For these version control tool, I chose git (using a company perforce). My code base through dropbox at home and work synchronized. When developing always get the latest version from the dropbox, git pull tube in this call. End of development, then the code synchronized to the dropbox, git was called push.
When push and pull of these two command to run, you need to run in the root directory of the code base (there is a .git folder in the root directory).
According to this feature, I wrote the following two script:
pullme.bat (from dropbox-p: \ get the latest code on repository-)
1: @echo off
2:
3: : POPCD
4: if exist .git goto SYNC
5: cd ..
6: goto POPCD
7:
8: :SYNC
9:
10: git pull p:/Repository
11:
12: @echo Now you are working with the latest copy
13:
14: pause
pushme.bat (the code synchronized to the Dropbox)
1: @echo off
2:
3: SETLOCAL ENABLEDELAYEDEXPANSION
4: SETLOCAL ENABLEEXTENSIONS
5:
6: : POPCD
7: if exist .git goto SYNC
8: cd ..
9: set PWD=%CD%
10: goto POPCD
11:
12: :SYNC
13:
14: p:
15:
16: cd p:/repository
17:
18: git pull %PWD%
19:
20: @echo Now p:/repository is up-to-date
21: pause
Dude, seen at the convenience of both scripts yet?
Convenience is that: When You are in <root> / A / B / C / ..., you do not need to keep cd .., until <root>. So simple and boring things, to the script to do it.
Reproduced in: https: //www.cnblogs.com/jalenwang/archive/2011/07/28/pull_push_me_for_git.html