- 浏览: 796707 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (651)
- Java (39)
- Java 初学者小问题 (66)
- 设计模式 (7)
- 项目管理 (3)
- 数据库 (1)
- 算法 (2)
- Java practices (6)
- Effective Java2读书笔记 (78)
- Linux (2)
- programming ruby 读书笔记 (5)
- Core Java Ninth Edition Volume I 读书笔记 (15)
- Pro Git 读书笔记 (12)
- Git (3)
- Maven in Action 读书笔记 (20)
- Web (12)
- 非技术类书籍 (11)
- 电影 (40)
- Web Cache (1)
- jquery (0)
- 历史 (4)
- Dive Into HTML5 读书笔记 (13)
- 三国演义小学毕业考 (79)
- 高效能人士的7个习惯 读书笔记 (12)
- Java Performance 读书笔记 (3)
- Protocol Buffer 学习笔记 (6)
- Mongo DB 学习笔记 (7)
- Morphia 学习笔记 (7)
- Algorithms -- Princeton 学习笔记 (13)
- String研究 (10)
- Hadoop: The Definitive Guide 读书笔记 (3)
- Java与模式读书笔记 (5)
- Date研究 (3)
- The Roman Empire 听课笔记 (4)
- Algorithms -- Standford 学习笔记 (16)
- Core Java Ninth Edition Volume II 读书笔记 (9)
- Thinking in Java 4th Edition 读书笔记 (21)
- Node : Up and Running 学习笔记 (5)
- Eloquent Javascript (8)
- Smashing Node.js 读书笔记 (1)
- Algorithms II -- Standford 学习笔记 (19)
- Algorithm II -- Princeton 学习笔记 (14)
- 网络安全 (2)
- Javascript (4)
- 正则表达式 (1)
- JAVA 7/8 (15)
- JVM (10)
- NodeJS (1)
- 鸟哥的linux私房菜读书笔记 (14)
- Web Service (1)
- The art of programming (9)
- Introduction to Algorithm 读书笔记 (4)
- Java 源码阅读 (0)
- Spring in Action 读书笔记 (2)
- Java Network Programming 读书笔记 (2)
最新评论
-
心存高远:
谢谢作者分享,刚好看到这里不太明白,现在茅塞顿开。不过runt ...
关于 Maven的传递依赖的理解 -
sxlkk:
851228082 写道甚至在某次技术会议现场遇到《Maven ...
关于 Maven的传递依赖的理解 -
851228082:
851228082 写道a----compile----b-- ...
第五章 坐标和依赖 -
851228082:
a----compile----b-----provided- ...
第五章 坐标和依赖 -
851228082:
甚至在某次技术会议现场遇到《Maven in action》的 ...
关于 Maven的传递依赖的理解
1. git svn allows you to use Git as a valid client to a Subversion server, so you can use all the local features of Git and then push to a Subversion server as if you were using Subversion locally.
2. Subversion can have only a single linear history, and confusing it is very easy. It's generally best to keep your history as linear as possible by rebasing your work and avoiding doing things like simultaneously interacting with a Git remote repository. Don't rewrite your history and try to push again.
3. git svn clone command imports an entire Subversion repository into a local Git repository:
$ git svn clone http://progit-example.googlecode.com/svn/ -T trunk -b branches -t tags
This runs the equivalent of two commands—git svn init followed by git svn fetch — on the URL you provide. The -T trunk -b branches -t tags part tells Git that this Subversion repository follows the basic branching and tagging conventions. If you name your trunk, branches, or tags differently, you can change these options. Because this is so common, you can replace this entire part with –s :
$ git svn clone file:///tmp/test-svn -s
4. git svn assumes that you won't have multiple remotes and saves all its references to points on the remote server with no namespacing. You can use the Git plumbing command show-ref to look at all your full reference names:
$ git show-ref
1cbd4904d9982f386d87f88fcelc24ad7c0f0471 refs/heads/master
aeelecc263l8l64f355a883f5d99cffOc852d3c4 refs/remotes/my-calc-branch
03d09bOe2aad427e34a6d50ff147128e76cOeOf5 refs/remotes/tags/2.0.2
50d02ccOadc9da4319eeba0900430ba219b9c376 refs/remotes/tags/release-2.0.1
4caaa711a50c77879a91b8b90380060f672745cb refs/remotes/tags/release-2.0.2
1c4cb508l44c513ffl214c3488abe66dcb929l6f refs/remotes/tags/release-2.0.2rcl
1cbd4904d9982f386d87f88fcelc24ad7c0f0471 refs/remotes/trunk
Tags are added as remote branches, not as real Git tags.
5. You can do several commits offline and then push them all at once to the Subversion server. To push to a Subversion server, you run the git svn dcommit command. This takes all the commits you've made on top of the Subversion server code, does a Subversion commit for each, and then rewrites your local Git commit to include a unique identifier. This is important because it means that all the SHA-1 checksums for your commits change. If you look at the last commit, you can see the new git-svn-id that was added:
$ git log − 1
commit 938bla547c2cc92033b74d32030e86468294a5c8
Author: schacon <schacon@4c93b258-373f-11de-be05-5f7a86268029>
Date: Sat May 2 22:06:44 2009 +0000
Adding git-svn instructions to the README
git-svn-id: file:///tmp/test-svn/trunk@79 4c93b258-373f-11de-be05-5f7a86268029
If you want to push to both a Git server and a Subversion server, you have to push (dcommit ) to the Subversion server first, because that action changes your commit data.
6. git svn rebase pulls down any changes on the server that you don't have yet and rebases any work you have on top of what is on the server.
7. Unlike Git, which requires you to merge upstream work you don't yet have locally before you can push, git svn makes you do that only if the changes conflict. If someone else pushes a change to one file and then you push a change to another file, your dcommit will work fine. The outcome is a project state that didn't exist on either of your computers when you pushed.
8. You can run git svn fetch to grab the new data, but git svn rebase does the fetch and then updates your local commits. You need to be sure that your working directory is clean when you run git svn rebase . If you have local changes, you must either stash your work or temporarily commit it before running git svn rebase —otherwise, the command will stop if it sees that the rebase will result in a merge conflict.
9. R unning dcommit on a master branch which has merged in topic branch commits works fine, except that when you look at your Git project history, it hasn't rewritten any of the commits on topic branch, instead, all those changes appear in the SVN version of the single merge commit. When someone else clones that work, all they see is the merge commit with all the work squashed into it; they don't see the commit data about where it came from or when it was committed.
10. To create a new branch in Subversion, you run:
$ git svn branch opera
This does the equivalent of the svn copy trunk branches/opera command in Subversion and operates on the Subversion server. It's important to note that it doesn't check you out into that branch; if you commit at this point, that commit will go to trunk on the server, not opera .
11. Git figures out what branch your dcommits go to by looking for the tip of any of your Subversion branches in your history—you should have only one, and it should be the last one with a git-svn-id in your current branch history.
13. You can run git svn log to view your commit history in SVN formatting. It only shows you commits that have been committed up to the Subversion server. It works offline and is more like the last known state of the commits on the Subversion server.
14. You can get the equivalent of svn annotate by running git svn blame [FILE] . Again, it doesn't show commits that you did locally in Git or that have been pushed to Subversion by others in the meantime.
15. You can also get the same sort of information that svn info gives you by running git svn info . It runs offline and is up to date only as of the last time you communicated with the Subversion server.
16. git svn create-ignore automatically creates corresponding .gitignore files according to svn:ignore properties of the SVN server for you so your next commit can include them. You can also run:
$ git svn show-ignore > .git/info/exclude
That way, you don't litter the project with .gitignore files. This is a good option if you're the only Git user on a Subversion team, and your teammates don't want .gitignore files in the project.
----- Migrating To Git -----
17. You need a mapping from the Subversion users to the Git authors. Create a file called users.txt that has this mapping in a format like this:
schacon = Scott Chacon <schacon@geemail.com>
selse = Someo Nelse <selse@geemail.com>
To get a list of the author names that SVN uses, you can run this:
$ svn log --xml | grep author | sort -u | perl -pe 's/.>(.?)<./$l = /'
And then you can import the SVN history to your git repo:
$ git-svn clone http://my-project.googlecode.com/svn/ --authors-file=users.txt --no-metadata -s my_project
--no-metadata tells Git not to include metadata that Subversion normally imports. Now not only does the Author field look a lot better( in a Git convention), but the git-svn-id is no longer there, either.
18. You'll move the tags so they're actual tags(light-weight) rather than strange remote branches, and then you'll move the rest of the branches so they're local:
$ cp -Rf .git/refs/remotes/tags/* .git/refs/tags/
$ rm -Rf .git/refs/remotes/tags
$ cp -Rf .git/refs/remotes/* .git/refs/heads/
$ rm -Rf .git/refs/remotes
19. The last thing to do is add your new Git server as a remote and push to it. Because you want all your branches and tags to go up, you can run this:
$ git push origin --all
20. A Perforce importer is also distributed with Git, but only in the contrib section of the source code—it isn't available by default like git svn . To run it, you must get the Git source code:
$ git clone git://git.kernel.org/pub/scm/git/git.git
$ cd git/contrib/fast-import
To set up your client, you must export the P4P0RT environment variable to point to the Perforce depot:
$ export P4P0RT=public.perforce.com:l666
Run the git-p4 clone command under fast-import folder to import the project from the Perforce server: (You must have Python and the p4 tool installed on your machine for this import to work.)
$ git-p4 clone //public/jam/src@all /opt/p4import
If you go to the /opt/p4import directory and run git log , you can see the git-p4 identifier in each commit which tracks the Perforce depot path and change number. You can use git filter-branch to remove the identifier strings:
$ git filter-branch --msg-filter ' sed -e "/^\[git-p4:/d"'
21. Quality importers are available for CVS, Clear Case, Visual Source Safe, even a directory of archives. If none of these tools works for you, you have a rarer tool, or you otherwise need a more custom importing process, you should use git fast-import . This command reads simple instructions from stdin to write specific Git data. All you have to do is tell fast-import what the content snapshots are, what commit data points to them, and the order they go in.
22. The input for git fast-import looks like:
commit refs/heads/master
mark :l
committer Scott Chacon <schacon@geemail.com> 1230883200 −0700
data 29
imported from back_2009_01_02deleteall
M 644 inline file.rb
data 12
version two
commit refs/heads/master
mark :2
committer Scott Chacon <schacon@geemail.com> 1231056000 −0700
data 29
imported from back_2009_01_04from :1
deleteall
M 644 inline file.rb
data 14
version three
M 644 inline new.rb
data 16
new version one
(...)
The format is like:
commit [branch]
mark: [mark]
commiter [author] [date]-[timezone]
data [commit-message-size]
[commit-message]
deleteall
M [file-mode] inline [file-path]
data [file-size]
[file contents]
…
mark is the fast-import term for an identifier you give to a commit; as you create commits, you give each one a mark that you can use to link to it from other commits.
23. Because many systems think of their revisions as changes from one commit to another, fast-import can also take commands with each commit to specify which files have been added, removed, or modified and what the new contents are. You could calculate the differences between snapshots and provide only this data, but doing so is more complex—you may as well give Git all the data and let it figure it out. If this is better suited to your data, check the fast-import man page for details about how to provide your data in this manner.
发表评论
-
授权申明
2012-04-13 18:40 851近日我将我在iteye上发布的《Pro Git读书笔记》做成电 ... -
《Pro Git》读后感
2012-03-18 18:26 2338开始接触Git是在去年年初,公司开始从Clearcase 过度 ... -
Chapter 9. Git Internals
2012-03-18 17:27 24661. Git is fundamentally ... -
Chapter 7. Customizing Git
2012-03-17 16:10 18431. Git uses a series of ... -
Chapter 6. Git Tools
2012-03-13 19:52 13651. Git is smart ... -
Chapter 5. Distributed Git
2012-03-05 23:10 16691. You can easil ... -
Chapter 4. Git on the Server
2012-03-03 16:23 19581. The preferred method ... -
Chapter 3. Git Branching
2012-02-29 15:22 22431. Branching means you ... -
Chapter 2. Git Basics
2012-02-27 21:17 15851. You can get a ... -
Chapter 1. Getting Started
2012-02-26 15:31 32691. Version control is a system ... -
《Pro Git》
2011-11-27 21:43 930A very good git tutorial: ...
相关推荐
问题描述: 在使用git 进行提交时, 出现上面这个报错, 导致无法提交. 报错大致意思就是创建index.lock文件失败,因为已经存在index.lock文件了. index.lock文件是在.git下面, 而.git是一般是隐藏的, 那么可以通过以下...
《Bonobo.Git.Server:构建本地Git服务器的全方位指南》 Bonobo.Git.Server是一款开源的应用程序,专为Windows环境设计,用以搭建和管理本地Git服务器。它提供了直观的Web界面,使得团队协作和代码版本控制变得...
Windows系统条件下,批量清除git版本管理配置文件,批量删除.git文件夹 使用方法:下载将该脚本文件,拷贝到要清除的项目的文件夹目录下,双击bat文件即可。
今天Git push的时候 fatal:remote error: You can't push to git://github.com/username/*.git Use git@github.com:username/*.git 看来我是没有权限push啊。 解决方法: git remote rm origin git remote add ...
离线安装包,亲测可用
.git-completion.bash
离线安装包,亲测可用
安装包,亲测可用
torch 项目完整代码,公司无法使用git,所以放了个备份在csdn上 (git clone https://github.com/torch/distro.git ~/torch --recursive)
aix7.2系统下安装git客户端
This course starts with an introduction to version control systems before you delve deeply into the essentials of Git. This serves as a primer for the topics to follow such as branching and merging, ...
find . -name '.git' | sed -e 's/^/rm -rf /g'| /bin/sh
As you progress through this book, you will learn how you can automate the usual Git processes by utilizing the hook system built into Git. The book also covers advanced repository management, ...
this book helps you get into the Git mindset—extensive discussion of corollaries to traditional systems as well as considerations unique to Git help you draw upon existing skills while looking out—...
在Mac上显示隐藏的.git文件夹,可以通过终端使用命令行操作。打开终端,输入以下命令使隐藏的文件和文件夹可见:mac显示隐藏的.git文件_mac 看不到.git文件夹
Learn Git in a Month of Lunches introduces the discipline of source code control using Git. Helpful for both newbies who have never used source control and busy pros, this book concentrates on the ...
8.Git版本管理工具.pdf
git视频教程.1.Git 命令 - git help、git config.mp4 git视频教程.2.Git 命令 - git init、git clone.mp4 git视频教程.3.1.Git 命令 - git add、git status.mp4 git视频教程.3.2.Git 命令 - git diff、git difftool....