git filter-branch应用
1.修改author和committer
git filter-branch --commit-filter '
export GIT_AUTHOR_EMAIL=me@example.com;
export GIT_AUTHOR_NAME=me;
export GIT_COMMITTER_EMAIL=me@example.com;
export GIT_COMMITTER_NAME=me;
git commit-tree "$@"
'
2.删除误提交的文件
a.用git filter-branch对所有分支上的commit执行命令操作,忽略对该文件的追踪,
将其从git仓库中移除,并重写每一条记录
//从指定的commit中删除误操作文件的记录
git filter-branch --tree-filter 'git rm -f --ignore-unmatch {{文件名}}' [commit1..commit2] //从当前分支的前30次提交开始遍历,删除误操作文件的引用
git filter-branch --tree-filter 'git rm -f {{文件名}}' HEAD~..HEAD
b.强制推送到远端
git push origin master --force
出处:https://walterlv.oschina.io/git/2017/09/19/delete-file-using-filter-branch.html
出处:http://www.jianshu.com/p/099e644b60fb
git filter-branch应用的更多相关文章
- Git Your branch is ahead of 'origin/master' by X commits解决方法
(1)方法1:git fetch origin (2)方法2(代码还需要):git push origin (3)方法3 (代码不需要):git reset --hard origin/$branch ...
- git: Your branch and 'origin/master' have diverged
git: Your branch and 'origin/master' have diverged - how to throw away local commits? - Stack Overfl ...
- Git master branch has no upstream branch的解决
Git master branch has no upstream branch的解决 在push代码时,出现“git master branch has no upstream branch”问题的 ...
- git branch & git remote branch
git branch & git remote branch $ git branch -h usage: git branch [<options>] [-r | -a] [-- ...
- [Practical Git] Filter commit history with git log arguments
In the last lesson, we learned how to format the git log output; in this lesson we will learn how to ...
- git branch(git 的branch 使用方法)
查看分支: $ git branch 该命令会类出当先项目中的所有分支信息,其中以*开头的表示当前所在的分支.参数-r列出远程仓库中的分支,而-a则远程与本地仓库的全部分支. 创 ...
- git 创建branch分支
开发者user1 负责用getopt 进行命令解析的功能,因为这个功能用到getopt 函数,于是将这个分支命名为user1/getopt.(1)确保是在开发者user1的工作区中cd /home/j ...
- git 创建branch分支【转】
转自:http://www.cnblogs.com/jackluo/p/3499731.html 开发者user1 负责用getopt 进行命令解析的功能,因为这个功能用到getopt 函数,于是将这 ...
- Git CMD - branch: List, create, or delete branches
命令格式 git branch [--color[=<when>] | --no-color] [-r | -a] [--list] [-v [--abbrev=<length> ...
- [git] git 分支( branch ) 的基本使用
分支( branches ) 是指在开发主线中分离出来,做进一步开发而不影响到原来主线. Git 存储的不是一系列的更改集( changeset ),而是一系列快照.当你执行一次 commit 时, ...
随机推荐
- 漫谈 Clustering (番外篇): Vector Quantization
在接下去说其他的聚类算法之前,让我们先插进来说一说一个有点跑题的东西:Vector Quantization.这项技术广泛地用在信号处理以及数据压缩等领域.事实上,在 JPEG 和 MPEG-4 等多 ...
- 绑定Ligerui中的ligerComboBox二级联动
$.ajax({ url: "HRHandler.ashx", data: "bz=getDepartData", cache: false, type: &q ...
- Bootstrap 历练实例 - 按钮(Button)插件复选框
复选框(Checkbox) 您可以创建复选框按钮 组,并通过向 btn-group 添加 data 属性 data-toggle="buttons" 来添加复选框按钮组的切换. & ...
- SummerVocation_Learning--java的线程死锁
public class Test_DeadLock implements Runnable { ; static Object o1 = new Object(),o2 = new Object() ...
- 抽屉head部分,hover应用,鼠标放上变色
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Apache 查找httpd.conf文件
Linux下查找httpd.conf文件 $ find / -name httpd.conf
- Linux-git安装
基本操作 安装yum install git 生成SSH KEY :先cd ~/.ssh,在这个目录下输入ssh-keygen,一直回车就可以了,这个时候就会出现id_rsd.pub公钥和id_rsa ...
- Fakeapp 入门教程(1):安装篇!
在众多AI换脸软件中Fakeapp是流传最广,操作最简单的一款,当然他同样也是源于Deepfakes. 这款软件在设计上确实是花了一些心事,只要稍加点拨,哪怕是再小白的人也能学会.下面我就做一个入门教 ...
- python模块汇总练习
模块练习 1.random模块 # print(random.random()) # print(random.randint(1,3)) #模拟随机验证码 def make_code(n=5): r ...
- IntentService和Service执行子线程对比
1.为何要用子程序 服务是在主线程中执行的,直接在服务中执行耗时操作明显不可取,于是安卓官方增加了IntentService类来方便使用 在Service中执行子程序代码如下 @Override pu ...