git-learning-game / oh-my-git

An interactive Git learning game!
https://ohmygit.org
Other
1.98k stars 143 forks source link

HINT: Index: Adding changes step by step #207

Open CodeAsm opened 4 months ago

CodeAsm commented 4 months ago

DO NOT use git mv [original] [target name] as this will add the rename to the cached files to be commited.

Us mv instead. or manually change the file name.

I learned to use git mv to rename or move files and this tripped me up in this level so much. i was looking into the sourcecode for any errors. https://github.com/git-learning-game/oh-my-git/blob/main/levels/index/steps#L20 is the exact spot that confused me, what where they checking? well, changes, that are NOT yet been cached or commited: $ git diff --name-only returns 0, nada, if you add them, and git mv emediatly adds them to the cach and commits the changes when you do a single commit (like git add broken_bottle, it ALSO adds the other renamed files if u use git mv)

TLDR: use MV, not GIT MV like i did