我需要帮助Git配置。我有一个项目,我想将其开发与其版本分开。目标是:
我应该如何设置存储库,分支机构等?我该如何提交发布?
(解决方案不应该基于用户帐户,因为我的Git托管仅限于此。)
答案 0 :(得分:1)
小演示:
[kan@altegom so18334364]$ git init --bare privrepo
Initialized empty Git repository in /private/tmp/so18334364/privrepo/
[kan@altegom so18334364]$ git init --bare pubrepo
Initialized empty Git repository in /private/tmp/so18334364/pubrepo/
[kan@altegom so18334364]$ git clone privrepo wc
Cloning into 'wc'...
warning: You appear to have cloned an empty repository.
done.
在你wc
中设置公共回购[kan@altegom so18334364]$ cd wc
[kan@altegom wc (master)]$ git remote add pubrepo /tmp/so18334364/pubrepo/
进行开发......
[kan@altegom wc (master)]$ echo test > file1
[kan@altegom wc (master)]$ git add file1
[kan@altegom wc (master)]$ git commit -m "development..."
[master (root-commit) 14bf15b] development...
1 file changed, 1 insertion(+)
create mode 100644 file1
推进privrepo
[kan@altegom wc (master)]$ git push
Counting objects: 3, done.
Writing objects: 100% (3/3), 230 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /tmp/so18334364/privrepo
* [new branch] master -> master
进行更多开发......
[kan@altegom wc (master)]$ echo test2 >> file1
[kan@altegom wc (master)]$ git commit -am "more development"
[master b90983d] more development
1 file changed, 1 insertion(+)
[kan@altegom wc (master)]$ git push
Counting objects: 5, done.
Writing objects: 100% (3/3), 264 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /tmp/so18334364/privrepo
14bf15b..b90983d master -> master
现在发布已准备就绪。公开发布:
[kan@altegom wc (master)]$ git push pubrepo master
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 421 bytes | 0 bytes/s, done.
Total 6 (delta 1), reused 0 (delta 0)
To /tmp/so18334364/pubrepo/
* [new branch] master -> master