标题党,其实我是想请教一下Git的相关问题
我有一个游戏文件夹,大致目录结构如下。
游戏目录 XxxGames/
文件夹 Plugin
一些文件
文件夹 Data
一些文件
文件夹 Save
一些存档
根目录下一些文件.exe/.log等
在XxxGames下 $ git init
然后 $ git remote add coding http://url.git
在目录下新建了一个 .gitignore 文件排除了一些文件
$ git add .
$ git commit -m "first commit"
$ git push coding master
推送成功了,但是发现有些目录和文件不需要同步
于是又修改 .gitignore 再次排除不需要的目录和文件
再 $ git add . 和 commit 的时候为什么不排除我刚更新的文件只是更新了.gitignore
本地已经有的文件夹(项目),要同步到git具体是个什么步骤。
push过以后再修改u.gitignore 再add再commit 为什么不排除我刚修改的排除
First of all, the first question, the specific steps are also very simple, roughly the following steps:
Initialize warehouse
Add gitignore file
Check the status of the files in the warehouse. Here you can see whether the files that should be ignored are ignored and whether the files that should be added can be seen
Add to staging area
Submit
Add remote warehouse
Push to remote warehouse
The
origin
in the above command can be specified at will, it is just customary to write it like this.Then there is the second problem. This is because those files have been tracked before, and modifying .gitignore again will not take effect (this seems to be a known bug of git). The best way to solve this problem is: if you have just made some modifications, submit these modifications first, and then run the following command:
You need to delete it first and then commit it. Next time you add a file, ignore will take effect