将文件上传到github中的分支
我知道这里有数百个教程,但我无法确定从哪里开始。 我正在使用MAC,并且运行在运行Ubuntu 14.04的远程系统上。 我想要做的是将文件夹上传到我的组织的github存储库。 已经有一个回购,我想创建一个分支,并上传我的文件和文件夹在该分支。
我尝试过
git branch branch_name
git checkout branch_name
但是该分支没有显示在网页上。 我也尝试从网页创建一个分支,但我不知道如何上传文件。 我也不确定如何实际导航到我想要上传的存储库。
请给我说明我该如何去做这件事。
谢谢!
ls -a
。如果你看到.git
,你可能是在正确的地方。 git init
。 git clone <https://something/foo/bar.git> <folder you want the repository to be in>
。 如果您不指定文件夹,它会在当前文件夹中创建它。 git checkout -b <your branch name>
git add <changed file> [<another changed file> [...]]
请注意,更改的文件可以是文件夹。 git rm <file>
这样Git知道你删除了它。 git commit -m "what you did"
git checkout master
和git merge <your branch name>
。 这会将新分支上的所有提交移动到原始分支。 git push
git push --set-upstream <https://something/foo/bar.git> <your branch name>
git pull
将在线分支的更改合并到本地。 git rebase master
。 对不起,如果我进入了太多细节!
您需要将分支推送到远程存储库。 请注意, -u
选项为本地分支设置上游,以便每个后续推送都引用给定的远程分支。
git push -u origin branch_name
如果您还没有任何已配置的远程存储库,可以通过复制存储库的URL并将其添加为远程存储库来实现。
git remote add origin git@github.com:/YOU/REPO.git
git checkout -b <branch>
创建一个分支 git push --set-upstream <remote> <my_branch>
eg origin <branch>
所有这些,如果你有一个远程设置。 如果不是,请首先设置一个遥控器。
链接地址: http://www.djcxy.com/p/4603.html