Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
778 views
in Technique[技术] by (71.8m points)

git - Sharing rerere cache

I've seen people recommend that all developers set up a symlink on their machine from C:project.git r-cache to a shared folder \server r-cache.

However, it would seem more convenient to share the folder by including it in the git repository itself, if that is possible. I've seen people mention this solution, but not actually how to do it.

Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It can be shared via a dedicated branch. You want to stop if there is a conflict on that branch and resolve it as it means that there were attempts to solve the same conflict in 2 different ways. Needless to say, that will be the exception to the rule.

For the others on this question, google "Branch per Feature" to see where this is useful.

Hooks can automate syncing the common rr-cache branch.

Here is what you need to automate. rereresharing is an example branch that you are merging to, rr-cache is a branch that stores the resolutions; all these steps worked without issue:

git checkout --orphan rereresharing start-sprint-1 
git --git-dir=.git --work-tree=.git/rr-cache checkout -b rr-cache
git --git-dir=.git --work-tree=.git/rr-cache add -A
git --git-dir=.git --work-tree=.git/rr-cache commit -m "initial cache"
git clean -xdf
git checkout rereresharing 
git merge --no-ff FTR-1
git merge --no-ff FTR-2
vim opinion.txt # resolve conflict 
git add -A
git commit
git checkout rr-cache 
git --git-dir=.git --work-tree=.git/rr-cache add -A
git --git-dir=.git --work-tree=.git/rr-cache commit -m "resolution"
git remote add origin ../bpf-central
git push origin rereresharing rr-cache 
cd - # assumes you were previously in the other local repo
git remote add origin ../bpf-central
git fetch
git branch rr-cache origin/rr-cache 
ls .git/rr-cache
git --git-dir=.git --work-tree=.git/rr-cache checkout rr-cache -- .
ls .git/rr-cache

You are now ready to do the same merge and you will have your conflict resolved.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...