Do you dare to think about synchronizing game configuration file archives to Git?
伊谢尔伦
伊谢尔伦 2017-05-02 09:44:06
0
2
686
标题党,其实我是想请教一下Git的相关问题

Approximate requirements


I have a game folder, the approximate directory structure is as follows.

Game Directory XxxGames/

  • Folder Plugin

    • Some files

  • Folder Data

    • Some files

  • Folder Save

    • Some archives

  • Some files .exe/.log etc. in the root directory

My operations


  1. Under XxxGames $ git init

  2. Then $ git remote add coding http://url.git

  3. Created a new .gitignore file in the directory to exclude some files

  4. $ git add .

  5. $ git commit -m "first commit"

  6. $ git push coding master

  7. The push was successful, but some directories and files did not need to be synchronized

  8. So I modified .gitignore to exclude unnecessary directories and files again

  9. When $ git add . and commit, why not exclude the file I just updated and just update .gitignore

Detailed questions


  1. What are the specific steps to synchronize an existing local folder (project) to git.

  2. After push, modify u.gitignore, then add and then commit. Why not exclude the exclusion I just modified?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
小葫芦

First of all, the first question, the specific steps are also very simple, roughly the following steps:

  • Initialize warehouse

git init
  • 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

git status -s
  • Add to staging area

git add .
  • Submit

git commit -m "commit message"
  • Add remote warehouse

git remote add origin <url of remote repository>
  • Push to remote warehouse

git push -u origin master

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:

git rm -r --cached .
git add .
git commit -m "gitignore已经生效"
过去多啦不再A梦

So I modified .gitignore to exclude unnecessary directories and files again

You need to delete it first and then commit it. Next time you add a file, ignore will take effect

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template