在添加实际内容之前,我正在使用git进行一些示例测试。
这就是我的所作所为:
enter code here
1) Create an empty git repository
$ mkdir git_trial2
$ cd git_trial2
$ git init (Creates a .git directory inside this)
$ cg-branch-add branch1 (Create a branch1 inside this git)
$ touch File1
$ echo "This is a test" >> File1
现在我想将File1添加到branch1。怎么做?
答案 0 :(得分:1)
你可以
git checkout branch1
git add File1
git commit -am "added File1"
git checkout other_branch
和File1只会在branch1
中答案 1 :(得分:1)
我们真的需要知道你的神秘cg-branch-add
命令是做什么的,但假设它只是添加了git branch
的分支,那么你需要从切换到该分支开始:
git checkout branch1
然后添加文件:
git add File1
并提交:
git commit