Git常用命令大全

目录

【xxxGitLab】

【Git创建】

【Git使用 - 服务器】

【GIT分支管理】

【Git使用 - 应用端应用】

【GIT新增、提交】


【xxxGitLab】

#git clone http://xxx/xxx/rk3399.git
cd rk3399

xxx@xxx-R730:~/git$ git clone http://xxx:xx/xxx/rk3399.git
Cloning into 'rk3399'...
Username for 'http://xxx:xx': xxx
Password for 'http://xxx@xxx:xx': 
warning: You appear to have cloned an empty repository.
Checking connectivity... done.

【Git创建】

git忽略文件检测及上传

git update-index --assume-unchanged build.gradle

git update-index --assume-unchanged settings.gradle

【Git使用 - 服务器】

Git地址克隆

# git clone http://xxx:xx/xxx/rk3399.git 

下拉代码:

# git pull

配置文件:

C:\Users\xxx\.gitconfig

C:\Users\xxx\.git-credentials

与下拉版本差异比较:

# git diff

git忽略文件检测及上传

# git update-index --assume-unchanged build.gradle
# git update-index --assume-unchanged settings.gradle

状态

# git status

下拉覆盖

# git checkout device/rockchip/common/BoardConfig.mk

引入

# git add  build/target/product/

# git add packages/services/Car/car_product/build/car_base.mk

提交更改与多行日志

# git commit -m '1.delete apps: RkExplorer Rk4kVideoPlayer Rk3grVideoPlayer Rk3grExplorer UserDictionaryProvider Music MusicFX MediaProvider Calculator DownloadProviderUi LiveWallpapersPicker cumentsUI droidipcam-HDMI IN'

提交多行日志

git commit -m

  1. ......
  2. ......

推送

# git push origin master

切换分支

git checkout branch_name

分支远程推送

git push origin xxx_xxxs

git push origin master

分支重命名

git branch -m dev develop

删除分支

git push origin --delete branch

强制推送到远程

git push -f origin :xxx_remote_branch_name

日志查看

# git log 

查看提交记录

# git show ****************(commitId)

设置邮件、用户名

#  git config --global user.email "xiaoming@xxx.cn"

#  git config --global user.name "xiaoming"

【GIT分支管理】

1.查看在游离状态下提交的最新commit号

查看所有分支及详情

git branch -av

合并分支

git merge test

删除分支

git branch -d test

删除本地分支

git branch -d 本地分支名

删除远程分支

 git push origin --delete 远程分支名

【Git使用 - 应用端应用】

    3  git status

    4  git log

    5  git commit --amend

    6  git push

    8  git log

    9  git status

   10  git config --list

   11  git config --global username "xiaoming"

   12  git config --global user.name "xiaoming"

   13  git config --global user.password "z7"

   14  git config --list

   15  git status

   16  git add .

   17  git commit -m "修改build.gradle文件"

   18  git push

   19  ssh-keygen -t rsa -C "xxx@xxx.cn"

   20  git status

   21  git push

   22  git remote -v

   23  git status

   26  git config --list

   28  git add .

   29  git commit -m "修改build文件"

   30  git push

   31  git status

   32  git push

   33  git log

   34  git reset --hard 7d13fe50fd6b447e4620a2ca3dc6169be175586c

   35  git log

   37  cd C:\Users\xxx

   42  cd Users/xxx/   44  git config --global credentials.helper store

   45  git status

   46  git add .

   47  git commit -m "测试"

   48  git push

   49  git remote -v

   50   git remote rm origin

   51  git remote add origin git@http://xxx:xx/:patient_monitor/xxx.git

   52  git remote -v

   53  git status

   55  git add .

   59  git commit -m "test"

   60  git push origin develop

   62  git push

   63  git remote -v

   64   git remote rm origin

   65  git remote -v

   66  git remote add origin git@http://xxx:xx/xxx/xxx.git

   67  git push

   68  git config --global push.default simple

   69  git push

   70  git push origin develop

   71  git remote -v

   72   git remote rm origin

   73  git remote add origin git@http://xxx:xx:xxx/xxx.git

   74  git push origin develop

   75   git remote rm origin

   76  git remote add origin http://xxx:xx/xxx/xxx.git

   77  git push origin develop

   78  git config --list

   79  git config --global credential.helper store

   81  git pull

   83  git push origin develop

   84  git history

   85  git --help

   86  history

【GIT新增、提交】

删除文件或者文件夹

git rm -r --cached 文件/文件夹名称

提交文件夹及子目录和文件

git add -A 文件夹

远程分支提交

git push origin develop

相关推荐

  1. Git命令大全

    2024-04-27 09:40:03       37 阅读
  2. Git命令大全

    2024-04-27 09:40:03       40 阅读
  3. git 命令大全

    2024-04-27 09:40:03       16 阅读
  4. Git命令大全

    2024-04-27 09:40:03       17 阅读
  5. git命令大全

    2024-04-27 09:40:03       13 阅读
  6. 华为命令大全

    2024-04-27 09:40:03       32 阅读
  7. hdc命令大全

    2024-04-27 09:40:03       17 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-27 09:40:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-27 09:40:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-27 09:40:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-27 09:40:03       20 阅读

热门阅读

  1. Oracle时间函数

    2024-04-27 09:40:03       35 阅读
  2. vue3前端调用后端接口实现分页,搜索

    2024-04-27 09:40:03       13 阅读
  3. 机器学习之sklearn基础教程

    2024-04-27 09:40:03       15 阅读
  4. 浅识数据结构之空间复杂度

    2024-04-27 09:40:03       13 阅读
  5. 编辑距离算法全解析:优化文本处理的关键技术

    2024-04-27 09:40:03       14 阅读
  6. 第二章:计算机系统基础知识之计算机网络

    2024-04-27 09:40:03       15 阅读
  7. 机器学习之sklearn基础教程

    2024-04-27 09:40:03       9 阅读