程序员开发实例大全宝库

网站首页 > 编程文章 正文

项目常用GIT操作命令(git项目管理流程)

zazugpt 2024-08-22 04:32:58 编程文章 16 ℃ 0 评论

Git 仓库更新依赖的命令:gradle --refresh-dependencies

gradle aR 完全编译; ./gradlew ecomm:packages:telephony:largescreen:aR

./gradlew ecomm:packages:ecommpublic:aR

将dev的分支上的某次提交c0a5abda8ed500aeb16a120f85d930a3b194fa4c 提交到audit,可以同时将多次提交合入(多次cherry-pick)

git checkout audit

git cherry-pick c0a5abda8ed500aeb16a120f85d930a3b194fa4c

git push

通过命令直接修改远程地址 : git remote set-url origin http://10.148.192.151:8080/tAPP810_TD/packages/apps/TMS

一、开发分支(dev)上的代码达到上线的标准后,要合并到 master 分支

git checkout dev

git pull

git checkout master

git merge dev

git push -u origin master

二、当master代码改动了,需要更新开发分支(dev)上的代码

git checkout master

git pull

git checkout dev

git merge master

git push -u origin dev

拉取新的分支:

git checkout -b TTR50_TH origin/TTR50_TH

git pull origin TTR50_TH

git 怎么访问某个commit下的文件:

git checkout [commitID]

Git 本地的撤销修改和删除操作

使用 git reset --hard

git reset --hard 257b201d(id 撤消一次commit)

git reset --soft HEAD~1 (撤消一次commit,修改还在)

# 删除 untracked files

git clean -f


# 连 untracked 的目录也一起删掉

git clean -fd


# 连 gitignore 的untrack 文件/目录也一起删掉 (慎用,一般这个是用来删掉编译出来的 .o之类的文件用的)

git clean -xfd


# 在用上述 git clean 前,墙裂建议加上 -n 参数来先看看会删掉哪些文件,防止重要文件被误删

git clean -nxfd

git clean -nf

git clean -nfd

# git出现 You are in the middle of a merge -- cannot amend问题解决方法

解决方法:

git reset --merge

注:取消合并

git log -- filename (git log filename)

可以看到该文件相关的commit记录

3. git log -p filename

可以显示该文件每次提交的diff

4. git show commit-id filename

查看某次提交中的某个文件变化

git show 999e31080f96c29d84e11a82e87bfa175976fe0e README.md

5.git show commit-id

根据commit-id查看某个提交


6.借助可视化工具 如 sourceTree 在最后一次修改的记录上 右键选中文件 查看历史修改

git查询某个人修改记录: git log --stat --author=diaoxiaolin

7. git commit -m “message” 命令行提交代码

8. 修改权限:chmod a+xw Compile_Tel_Pub_eComm.sh

9. linux查找替换:find . -type f -name '*.gradle' | xargs perl -pi -e 's|tuiAddon:1.0.0.+|tuiAddon:1.0.0.+|g'

命令格式:find -name '要查找的文件名' | xargs perl -pi -e 's|被替换的字符串|替换后的字符串|g'

DTS:DTS2018101200000

Description: ChannelMode send ready broadcast.

Team:OTHERS

Feature or Bugfix:Bugfix

git commit -m "DTS:DTS2018071002664 Description::Feature add CR gdpr. Team:OTHERS Feature or Bugfix:Feature"

代码下载

TTR60_R1_X5_B018_20201029_NANNING 分支已经拉出,配套关系如下:

TAPP: TTR60_R1_X5_B018_20201029_NANNING

代码拉取(linux):

repo init -u ssh://10.148.192.151:29418/tAPP810_TD/.repo/manifest -m Master_B035_20210118_ADAPT_520S.xml --repo-url=ssh://10.148.192.151:29418/tAPP810_TD/repo --no-repo-verify

repo sync -d -c

repo start Master_B035_20210118_ADAPT_520S --all

repo branches

主线:

repo init -u ssh://10.148.192.151:29418/tAPP810_TD/.repo/manifest -m master.xml --repo-url=ssh://10.148.192.151:29418/tAPP810_TD/repo --no-repo-verify

repo sync -d -c

repo start master --all

repo branches

多仓合并后的仓

tapp mcx7.0 主线

git clone ssh://dwx563304@10.148.192.151:29418/application/packages/tAPP810_TD

TMS: tui_TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/packages/apps/TMS

git checkout -b tui_TTR60_R1_X5 origin/tui_TTR60_R1_X5

登录(EmmAgent): tui_TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/packages/apps/EmmAgent

git checkout -b tui_TTR60_R1_X5 origin/tui_TTR60_R1_X5

? 设备管理(MDMClient ):

? Touc:

? TdLogUploader:

通讯录:

(1)EContactsProvider 分支: venus_TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/packages/providers/EContactsProvider

git checkout -b venus_TTR60_R1_X5 origin/venus_TTR60_R1_X5

(2)Display 分支(小屏): tui_chameleon_master_TTR60_R1_X5 备注:小屏分支整合到大屏分支

(3)Display 分支(大屏): tui_TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/packages/apps/Contacts/Display

git checkout -b tui_TTR60_R1_X5 origin/tui_TTR60_R1_X5

(4)Logic 分支: tui_TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/packages/apps/Contacts/Logic

git checkout -b tui_TTR60_R1_X5 origin/tui_TTR60_R1_X5

Tdconfig

?(1)Tdconfig 分支: TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/platform/TdConfig

ChannelMachineAdapterLayer

(1)ChannelMachineAdapterLayer 分支: TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/ChannelMachineAdapterLayer

TAPP二进制仓:

(1)仓:tAPP810_TD/apps/maplib 分支: TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/apps/maplib

默认分支 TTR60_R1_X5

(2)仓:tAPP810_TD/platform/pagedList 分支: TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/platform/pagedList

默认分支 TTR60_R1_X5

(3)仓:tAPP810_TD/services/locationservice 分支: TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/services/locationservice

默认分支 TTR60_R1_X5

(4)仓:tAPP810_TD/platform/appDeviceAbstractLayer 分支: TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/platform/appDeviceAbstractLayer

默认分支 TTR60_R1_X5

(5)仓:tAPP810_TD/apps/messageApplib 分支: TTR60_R1_X5_B018_20201029_NANNING

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/apps/messageApplib

默认分支 TTR60_R1_X5_B018_20201029_NANNING

(6)仓:tAPP810_TD/services/messageservice 分支: TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/services/messageservice

默认分支 TTR60_R1_X5

(7)仓:tAPP810_TD/platform/log 分支: TTR60_R1_X5 备注:java/cpp

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/platform/log

默认分支 TTR60_R1_X5

WeCommSupport

(1)tAPP810_TD/apps/WeCommSupport 分支: TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/apps/WeCommSupport

默认分支 TTR60_R1_X5

(1)tAPP810_TD/platform/sip 分支: TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/platform/sip

默认分支 TTR60_R1_X5

(1)tAPP810_TD/platform/log 分支: TTR60_R1_X5

代码拉取:

git clone ssh://10.148.192.151:29418/tAPP810_TD/platform/log

默认分支 TTR60_R1_X5

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表