1. Git如何获得两个版本间所有变更的文件列表
用“git log”或者“git log|grep <name>”查到关注的版本的哈希值,然后
git diff dd1b3f4d24e9bc8813e0ddb68396684aa2cd684d 83ca581804524f0d271c82779b102bb20cca32ce --stat
或者
git diff dd1b3 83ca5 --stat
前4~6位就可区分
2. 典型的git checkout/checkin操作
git clone ssh://192.168.27.12:29418/8939/amss_oem/modem_proc.git -b develop-bp-master-37
git checkout -b tangjian_bug42272
git add <file>
git commit -m "bug 42272, provide different header file according to different project" files
git push ssh://[email protected]:29418/8939/amss_oem/modem_proc.git HEAD:refs/for/develop-bp-master-37
一般除非文件很多,不主张用
git add .
否则很多中间编译产生的文件也add到cache中了。
对于git push和git pull,可以写个脚本。
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import argparse class InputError(Exception): def __init__(self, value): self.value = "Build Variant Input Error: " + value def __str__(self): return repr(self.value) prompt = "please give input like $0 -a pull -m bp -s modem_proc -n 40 " parser = argparse.ArgumentParser() parser.add_argument("-m", "--module") parser.add_argument("-s", "--submodule") parser.add_argument("-n", "--no") parser.add_argument("-b", "--branch") parser.add_argument("-a", "--action") args = parser.parse_args() if args.module == None or args.submodule == None or args.no == None or args.action == None: raise InputError(prompt) br = "develop-" + args.module + "-master-" + args.no folder="8939" if args.module == "ap": folder += "/platform" else: folder += "/amss_oem" cmd = "git %s ssh://192.168.27.12:29418/%s/%s.git HEAD:refs/for/%s"%(args.action, folder, args.submodule, br) print cmd ret = os.system(cmd)
3. git clean -df, 清除不在库中的文件
时间: 2025-01-05 03:54:19