git当svn用

on under auxilary
1 minute read

About

1.git pull相当于svn update
2.git push相当于svn commit
3.git有本地仓库,svn没有本地仓库,上面git push前要git commit -a -m 到本地仓库
4.git多人协作  https://gist.github.com/suziewong/4378619
5.同一个github帐号多台不同电脑时可用下面代码方便同步数据

Code

# 每天第1次接触电脑时运行py3 gitTool.py --update
# 每天第-1次接触电脑时运行py3 gitTool.py --commit

import sys
import os
dirList = ["~/myblog/", "~/3xp10it.github.io/",
           "~/mypypi/", "~/mytools"]
if sys.argv[1] == "--update":
    for eachDir in dirList:
        os.system("cd %s && git pull" % eachDir)
if sys.argv[1] == "--commit":
    os.system("bash ~/mytools/up.sh")
    for eachDir in dirList:
        os.system(
            "cd %s && git add . && git commit -a -m 'up' && git push -u origin master" % eachDir)
git, svn
home
github
archive
category