Category - Git

2024-02-18 18:44:56    24    0    0
## 一. 删除单个 ### 1. 本地删除 tag ``` git tag -d v1.1 ``` ### 2. 删除远程 tag ``` git push origin :refs/tags/v1.1 ``` ### 3. 查看本地 tag ``` git tag -l ``` ### 4. 查看远程 tag ``` git ls-remote origin ``` ## 二. 批量删
2023-10-10 18:00:49    120    0    0
命令格式: ```sh git archive --format=zip --output=../export_last_modified.zip $(git diff --name-only ) ``` 例如: ```sh git archive --format=zip --output=../v1.zip 84b75b4877d9034c3b84f7feafa76a43586
2022-09-18 16:48:06    255    0    0
## 查询占用空间最多的五个文件 ``` git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -5 | awk '{print$1}')" ``` ## 从git历史中移除 ``` git filter-branch --force --
2022-09-18 16:46:00    213    0    0
如果你之前的项目提交了一些敏感数据,或者要清除以前提交的记录,给出下面解决方案. 1. 检出一个新的分支 ``` git checkout --orphan latest_branch ``` 2. 暂存所有文件 ``` git add -A ``` 3. 提交刚刚暂存的文件 ``` git commit -am
2020-11-24 10:53:43    215    0    0
使用命令: ``` git log file.txt ``` 然后按`G`(shift+g)
2020-11-23 16:13:15    318    0    0
方法一: ``` git pull origin master --allow-unrelated-histories ``` 方法二: ``` git push --force origin master ```
2020-10-09 11:32:36    247    0    0
首先命令行新建.gitignore文件。 ``` touch .gitignore ``` 然后打开.gitignore文件 ``` vi .gitignore ``` 添加要忽略的文件或目录 ``` node_modules/ .project unpackage/ .DS_Store ``` 如果之前已经提交过被忽略的文件夹(比如unpackage文件夹),那需要执行以下命令行: ```
2020-10-08 21:10:59    188    0    0
## 添加远程仓库 ``` git remote add origin https://github.com/admpub/nging.git ``` ## 把本地库的所有内容推送到远程库上 ``` git push -u origin master ``` 把本地库的内容推送到远程,用git push命令,实际上是把当前分支master推送到远程。 由于远程库是空的,我们第一次推送mast
GIT    2019-03-16 10:32:26    174    0    0
获取该文件的提交记录 ``` git log --pretty=oneline 文件路径 ``` 或 ``` git show 6b14b5883e5a03d5e2110eb78633f622e81a36ac 文件路径 ``` 就是这么简单
GIT    2019-03-16 10:32:26    198    0    0
1. `git clone --mirror http://old.ip/score-group/rest-score.git old.git` 解释:克隆原仓库的镜像。其中包括的项目的所有信息,以及config 注意:是“http://”不是“https://” 2. `cd old.git` 进入上面的镜像目录(一定要进入该目录,执行步骤3) 3. `git remote set-url