我在Github中创建了一个新的仓库,现在我只想推送gitignore文件。在下一次提交时,我想推送其余文件。
我所做的步骤-
<Page.Resources>
<MenuFlyout x:Key="MYFLYOUT">
<MenuFlyoutItem Text="Paste" Click="MenuFlyoutItem_Click"></MenuFlyoutItem>
</MenuFlyout>
</Page.Resources>
<Grid>
<RichEditBox Name="EditorBox" ContextFlyout="{StaticResource MYFLYOUT}" Paste="EditorBox_Paste" />
</Grid>
所以我将> git branch
* master
> git branch -r
> git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: .idea/inspectionProfiles/Project_Default.xml
new file: .idea/vcs.xml
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
modified: .idea/workspace.xml
和.idea/workspace.xml
文件夹一起放入了gitignore
.idea
我的问题是,因为远程回购中没有分支,所以将执行push命令。
我们非常感谢您的帮助。
更新-1
我尝试了以下操作-
> git add .gitignore
> git commit -m 'gitignore only'
现在,当我检查远程github时,我可以看到所有文件都已添加。
答案 0 :(得分:1)
两个文件Project_Default.xml
和vcs.xml
已经处于“暂存”状态。将它们添加到.gitignore
不会影响在下一个git commit
中将它们集成到提交中的事实(因为它们是“暂存的”)。
我们在gitignore documentation中看到:“已经被Git跟踪的文件不受影响”
答案 1 :(得分:0)
所以,回顾一下:
.idea/inspectionProfiles/Project_Default.xml
和.idea/vcs.xml
.gitignore
.gitignore
我理解正确吗?然后,您需要:
.idea/inspectionProfiles/Project_Default.xml
和.idea/vcs.xml
的登台$ git reset .idea/inspectionProfiles/Project_Default.xml
$ git reset .idea/vcs.xml
$ git push origin master
$ git branch --set-upstream-to=origin/master master
请注意,您可以通过指定远程分支名称来执行步骤2:
$ git push origin master:remotemaster