我试图在GitHub上添加一个分支到主分支,并将一个文件夹推到该分支上。
分支的文件夹结构看起来像- SocialApp/SourceCode/DevTrunk/SocialApp和所有源代码文件都在最后一个文件夹中。
我正在使用以下Git命令:
git add *
git commit -m with the message
git push
这只是将第一个文件夹“SocialApp”推到GitHub上,而忽略了文件夹内的文件夹SourceCode。我怎么解决这个问题?
我试图在GitHub上添加一个分支到主分支,并将一个文件夹推到该分支上。
分支的文件夹结构看起来像- SocialApp/SourceCode/DevTrunk/SocialApp和所有源代码文件都在最后一个文件夹中。
我正在使用以下Git命令:
git add *
git commit -m with the message
git push
这只是将第一个文件夹“SocialApp”推到GitHub上,而忽略了文件夹内的文件夹SourceCode。我怎么解决这个问题?
当前回答
这对我很有效
git add -f *
其他回答
这招对我很管用:
git add . --force
我只需要这样做,我发现可以很容易地在子目录中添加文件。你只需要在repo的“top目录”上,然后运行如下命令:
$ git add ./subdir/file_in_subdir.txt
如果子目录被忽略,检查.gitignore文件。
然后再试一次
git add --all
git commit -am "<commit message>"
git push
我简单地用了这个:
git add app/src/release/*
您只需要指定要添加的文件夹,然后使用*递归地添加其中的所有内容。
导航到文件夹,你有你的文件,如果你是在windows机器上,你将需要启动git bash,从中你将得到一个命令行界面,然后使用这些命令
git init //this initializes a .git repository in your working directory
git remote add origin <URL_TO_YOUR_REPO.git> // this points to correct repository where files will be uploaded
git add * // this adds all the files to the initialialized git repository
如果您在将文件合并到主文件之前对其进行了任何更改,则必须通过执行提交更改
git commit -m "applied some changes to the branch"
在这之后,将分支签出到主分支