Closed patrickmj closed 12 years ago
I mv'd README to loop, and tried "git mv loop loop.php," with the error "fatal: not under version control, source=loop, destination=loop.php." What's up with that?
What does the command "git" actually do, anyway?
Probably you did something like "mv README loop" first? when you did that, it became a file that git knows nothing about, so when you tried to do "git mv loop loop.php", it didn't know the file you were talking about.
Do a "git status" and git will tell you what files it is tracking, and where they are in the process.
Probably, if you do "git add loop.php" it'll get things right again.
The command "git" really starts the git application. The things that come after it ("move", "push", etc.) are the particular commands within git to do. Typing "git" is the equivalent of double-clicking an icon to open an application. The next things are the equivalent of selecting an action from a drop-down menu.
Got it! Do you usually only work with one file at a time? For instance, I add README, then commit the changes, then push it to the hub; but I've also got another file, loop.php. When I add README, commit -m, and then push, does it only work with the file that's been added?
Yay! Depends on the complexity of the project and task, among other factors like policy about when to commit or not. Some quick changes or bugfixes it's just one file the way you describe. Bigger, more complex tasks generally you work with a bunch of different files. Then "git add" for all the files and commit them all in one go. "git commit -a" is a shortcut for adding all the changes in all the files that git is tracking, so you don't have to "git add" each one individually.
So, change lots of files, "git commit -a -m" adds all the changes and commits them. Then "git push" pushes all the changes that you've committed to github.
See, for example, this recent commit to a branch of Exhibit Builder https://github.com/omeka/plugin-ExhibitBuilder/commit/70e43b22bca2be167be9cfb5a17e7f4c56c2803a
If you do "git mv README abo.php" and commit / push that change, the code will be much easier to read in github.