New to github. I'm using it on windowns. Due to some confusion when I started this job, rather than work directly on the local copy of the project/repository (.net web forms by the way) I cloned the local copy to another directory and worked there. This meant that I was accumulating changes that were not in the local copy for the repository but in the cloned version.
While I could do a diff on every file in the solution and move only those that had changed from my cloned copy to the local repository directory, I feel this would be difficult and perhaps dangerous. I would like to overwrite the entire solution with my current cloned version. Then I would like to make that the next version checked into Git.
The problem I see is that I would not have checked anything out so the status of files would not be correct to be sent back up to the repository. Also, Git would have no idea what files had changed and which hadn't so they all would have to go into the repository just to be safe. Is there a way to mark all files as "changed" befpre checking them in?
Someone suggested that it would be easier for me to create a new repository for my cloned version, name it something like "solution2019" and sunset the old respository. Any advice would be appreciated.
I'm not certain I understand your setup, so my answers may be all wrong if I misunderstood anything. It sounds to me like you're saying that you:
Now that you've done all of that, you want to:
First, you say you're concerned that you didn't check anything out. You're in luck! With git, you don't ever check out files because it doesn't use the check-out/check-in model that older version control systems used. You change the files, add them to the "index", and then "commit" the changes to the repository. Git figures out the rest, including what files had actually changed and which ones hadn't. The one caveat is that you have to tell git if you want it to start tracking a new file or stop tracking a file you've deleted. This can be done pretty easily in the "add to the index" step.
So, assuming that you can make the directory where the local version of the remote repository look exactly like the modified version of your copy of the local version of the remote repository, then you can commit the contents with these two commands:
git add --all git commit
I hope that helps and let me know if you have any other questions.
Thank you so much for replying. It's an odd question, I know. In terms of the three things in your list, only the last two are true. I did NOT use the git clone command or any git command, in fact. I simply copied the local directory that holds the project that git uses to another directory and worked there. So the git local directory was left alone and I worked in the copied directory. Git was never part of the equation, unfortunately.
I think you are saying that I can copy the entire directory I've been working in and overwrite the git local directory, then use the add and commit commands you list below? The result would be that the next version in git would be whatever is in the directory I would use to overwrite the current git local directory. I will read up on the add command. I'm a bit confused as to how or when git would know if I added or deleted a file so it could decide how to track it. Will the add command as you have it below force git to ask me about new or deleted files or do I have to specify them myself?
I will read about it but any pointers would be appreciated. Thanks again. I am used to TFS (source save) and subversion. :-)
I think you are saying that I can copy the entire directory I've been working in and overwrite the git local directory, then use the add and commit commands you list below? The result would be that the next version in git would be whatever is in the directory I would use to overwrite the current git local directory.
Yes, that's what I'm saying. You'll want to use something that will make the destination directory an exact copy of the source directory, like rsync or robocopy, because if you use a normal copy, any files that you deleted in the source will still exist in the destination. But other than that, it should work just fine.