I have a local git repo. I can run git status and see that there are untracked files with changes and new files. Since doing the steps that created my repo, I’ve been editing file names in my local project folder, adding new files, as well as editing file content. Those changes need to be applied to the local repo. Because I don’t have a good understanding of using git commands, I’m unsure how to proceed to update the repo. I want to update it to save the version that is working so that as I continue to make changes I don’t walk on what I’ve done. I need to know how to proceed.
I’ve set the dir to my project’s root folder and run git status. Here are the steps I think I need to take to accomplish a ‘point in time’ snapshot of all the code in my project:
-
git add . [As I understand it, this will put ALL my code files in the active root folder in the git staging area. I don’t need to issue a git init command because that is only used to initiate a new git repo. What happens to files in the repo whose names have been edited? Do they remain in the repo under the old names? If so, I will want to delete them because the renamed files take their place. Is there a ‘git replace all’ command that I need to learn about?]
-
git commit <repo_ID> --m “info to ID the commit” [As I understand it, this will prepare the files to be ‘pushed’ to the repo, but I don’t know the <repo_ID> value, or, for that matter, if one is needed because I have only the one local repo. I’m uncertain of the syntax for this command. ]
-
git push [As I understand it, this will cause git to put everything I pushed into the local repo and will resolve all deltas in content. How this happens is unclear to me. I’m uncertain of the syntax for this command, too.]
I’ve searched and read instructions online, but I didn’t find an example of what I describe, ie, pushing my entire project to the local repo with the intent to establish it as the current state of the repo.
I have NOT experimented with git commands for fear that I’ll screw up the repo and make a mess I don’t know how to fix.
I have 2 requests: 1) please comment on what I’ve posted above and point out what you think I don’t understand and 2) suggest things to read or exercises with git that I can learn from. Ultimately, I’m going to need to know what git commands to make in what order and the syntax for each command. When all is said and done, I want to have an updated repo that contains a snapshot of a point in time that does not have files that I no longer have in my local project folders.