我知道有数以百计的教程,但我不知道从哪里开始。我使用的是一个MAC和一个运行Ubuntu14.04的远程系统。我想要做的是将文件夹上传到组织的github存储库。已经存在一个回购,我想要创建一个分支,并上传我的文件和文件夹在该分支。
我试着做
git branch branch_name
git checkout branch_name但是,分支没有出现在网页上。我也尝试从网页创建一个分支,但我不知道如何上传文件到它。我也不知道如何实际导航到我想上传到的存储库。
请给我指示一下我怎么做这件事。
谢谢!
发布于 2016-11-16 22:42:38
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。
发布于 2016-11-16 22:33:30
您需要将分支推到远程存储库。注意,-u选项为您的本地分支设置了上游,因此下面的每一个推送都引用给定的远程分支。
git push -u origin branch_name如果尚未配置任何远程存储库,则可以复制存储库的URL并将其添加为远程存储库。
git remote add origin git@github.com:/YOU/REPO.git发布于 2016-11-16 22:32:59
git checkout -b <branch>创建分支git push --set-upstream <remote> <my_branch> (例如origin <branch> )如果你有遥控器的话。如果没有,请先设置一个遥控器。
https://stackoverflow.com/questions/40643488
复制相似问题