赞
踩
Git提交纪录是项目的灵魂。
前段时间,因为某些特定原因。导致需要进行仓库的迁移。但是又想保留原有的提交纪录。于是查询了下,发现有git push --mirror
命令可以完美符合我的要求。
cd
命令到达本地仓库的.git
路径下;bigdata
仓库;git push --mirror https://github.com/SeanYanxml/bigdata.git
将本地仓库推送到远端的仓库;附:
- 发现之前的项目经理没有使用这样的流程导致很多的提交纪录丢失了,应该算作工作的失误了。
- 其次,项目重构也会导致提交纪录的丢失。这对于项目经理,也就是项目的管理者是一件至关重要的事情。(重构的提交纪录的管理措施暂时没有想到好的办法。)
localhost:Gitrep Sean$ cd bigdata localhost:bigdata Sean$ ls README.md apps kafka mongodb pom.xml redis spark spark-redis spark-streaming word2vec zookeeper localhost:bigdata Sean$ ls -a . .DS_Store .git .project README.md kafka pom.xml spark spark-streaming zookeeper .. .classpath .gitignore .settings apps mongodb redis spark-redis word2vec localhost:bigdata Sean$ cd .git localhost:.git Sean$ ls COMMIT_EDITMSG ORIG_HEAD description info packed-refs FETCH_HEAD branches hooks logs refs HEAD config index objects sourcetreeconfig localhost:.git Sean$ git push --mirror https://github.com/SeanYanxml/bigdata.git Counting objects: 714, done. Delta compression using up to 4 threads. Compressing objects: 100% (502/502), done. Writing objects: 100% (714/714), 238.09 KiB | 0 bytes/s, done. Total 714 (delta 176), reused 0 (delta 0) remote: Resolving deltas: 100% (176/176), done. remote: remote: Create a pull request for 'master' on GitHub by visiting: remote: https://github.com/SeanYanxml/bigdata/pull/new/master remote: To https://github.com/SeanYanxml/bigdata.git * [new branch] master -> master localhost:.git Sean$ git log commit 7af660c5064440edad9dbe72991beac5b9dad518 Author: Sean Yan <huaianyanxu@163.com> Date: Wed Nov 14 22:06:10 2018 +0800 Update last commit. commit e7edf73121aac282f8a0ab9e80aa9db06fe8dc83 Author: Sean Yan <huaianyanxu@163.com> Date: Wed Nov 14 22:05:52 2018 +0800 Spark Streaming & Mongodb Init. commit d211ac5c2518c5516f9e27388137990cc63ef4af Author: Sean Yan <huaianyanxu@163.com> Date: Sat Aug 4 23:15:16 2018 +0800 Kafka consumer & provider demo. commit 000e015bf10cb3f1b0d5289b53f2145641f41b85 Author: Sean Yan <huaianyanxu@163.com> Date: Thu Aug 2 15:52:19 2018 +0800 The queue demo of zk. commit 85bb3d670e4e3ef29aa7a71f55395289c14eb189 Author: Sean Yan <huaianyanxu@163.com> Date: Wed Aug 1 15:23:35 2018 +0800 The demo of the zk demos - balance. commit 049b90f5b0e82e29e87dc1a0c41765da775f7172 Author: Sean Yan <huaianyanxu@163.com> Date: Wed Aug 1 00:57:37 2018 +0800 Half of the code of the zk demo balance . commit 6cf6ecf50a0be05f14e93afee4b276295190aa25 Author: Sean Yan <huaianyanxu@163.com> Date: Tue Jul 31 11:02:26 2018 +0800 Distribute service of zk. commit e48be11333c4e37aba4dbc12204575b431d4c483 Author: Sean Yan <huaianyanxu@163.com> Date: Tue Jul 31 00:02:21 2018 +0800 The lock demo of zk. commit 8c0c4b7d7d213aadea31c818aae7e1c4299183a6 Author: Sean Yan <huaianyanxu@163.com> Date: Mon Jul 30 17:33:35 2018 +0800 ZK Demos 2: subscribe. commit 22d06a128269260fb0f2000458eef025efd489c9 Author: Sean Yan <huaianyanxu@163.com> Date: Mon Jul 30 14:46:29 2018 +0800 Update the struct of the project zk-demo. commit d70e4718dbe1b4d6a1b1592b26fda3f38b6cbf24 Author: Sean Yan <huaianyanxu@163.com> Date: Mon Jul 30 14:40:57 2018 +0800 localhost:.git Sean$ git rebase -i HEAD~100 fatal: Needed a single revision invalid upstream HEAD~100 localhost:.git Sean$ git rebase -i HEAD~20 fatal: This operation must be run in a work tree fatal: This operation must be run in a work tree Cannot rebase: You have unstaged changes. Please commit or stash them. localhost:.git Sean$ git log commit 7af660c5064440edad9dbe72991beac5b9dad518 Author: Sean Yan <huaianyanxu@163.com> Date: Wed Nov 14 22:06:10 2018 +0800 Update last commit. commit e7edf73121aac282f8a0ab9e80aa9db06fe8dc83 Author: Sean Yan <huaianyanxu@163.com> Date: Wed Nov 14 22:05:52 2018 +0800 Spark Streaming & Mongodb Init. commit d211ac5c2518c5516f9e27388137990cc63ef4af Author: Sean Yan <huaianyanxu@163.com> Date: Sat Aug 4 23:15:16 2018 +0800 Kafka consumer & provider demo. commit 000e015bf10cb3f1b0d5289b53f2145641f41b85 Author: Sean Yan <huaianyanxu@163.com> Date: Thu Aug 2 15:52:19 2018 +0800 The queue demo of zk. commit 85bb3d670e4e3ef29aa7a71f55395289c14eb189 Author: Sean Yan <huaianyanxu@163.com> Date: Wed Aug 1 15:23:35 2018 +0800 The demo of the zk demos - balance. commit 049b90f5b0e82e29e87dc1a0c41765da775f7172 Author: Sean Yan <huaianyanxu@163.com> Date: Wed Aug 1 00:57:37 2018 +0800 Half of the code of the zk demo balance . commit 6cf6ecf50a0be05f14e93afee4b276295190aa25 Author: Sean Yan <huaianyanxu@163.com> Date: Tue Jul 31 11:02:26 2018 +0800 Distribute service of zk. edit bdb4997 The action to simulate the vote for leader. commit e48be11333c4e37aba4dbc12204575b431d4c483 Author: Sean Yan <huaianyanxu@163.com>
未知
温故而知新,可以为师也。今天有个朋友留言提问。git push --mirror
和git push
有什么区别?
git push <origin> <master>
拷贝和提交某个分支.git push --mirror <remote-git-url>
拷贝所有分支.--mirror
Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not limited to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. This is the default if the configuration option remote.<remote>.mirror is set.
- Others
git push --mirror
VSgit push --all
?
https://git-scm.com/docs/git-push
Git命令大全
git push 命令
git push --mirror $URL
如何迁移一个Git仓库
如何使用push将一个git远程镜像到另一个远程镜像
git push --mirror $URL
git push命令
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。