How to commit changes if remote repository changed directory structure?
I have a lot of local changes to add, commit, and push. Right now our directory structure is 1/2/3. Another developer decided to move everything up one level, so used git move to move 3 to 2, and removed 3, so now the level is 1/2. However, locally, all of my changes are in 1/2/3.
I want to commit my changes and merge them into the new directory structure. How would I go about doing that?
Thanks!
Signature · 2 lines
View this message in context: http://www.nabble.com/How-to-commit-changes-if-remote-repository-changed-directory-structure--tp22612715p22612715.html Sent from the git mailing list archive at Nabble.com.
Quoted 7 lines · andholt
I have a lot of local changes to add, commit, and push. Right now our directory structure is 1/2/3. Another developer decided to move everything up one level, so used git move to move 3 to 2, and removed 3, so now the level is 1/2. However, locally, all of my changes are in 1/2/3.
I want to commit my changes and merge them into the new directory structure. How would I go about doing that?
First, commit your changes. Then merge the other developer's changes. :)
This is exactly the sort of case that git's rename detection should handle; it should detect that the other side renamed files, and then consider your changes against the newly named files. The only thing it _won't_ handle is new files that you added in 1/2/3. You will have to manually move them to 1/2 as part of the merge (there has been discussion of "detect that this whole directory seems to have had its content moved and automatically move new files", but the patches have not been accepted).
-Peff
Quoted 11 lines · Jeff King
Quoted 7 lines · andholt
I have a lot of local changes to add, commit, and push. Right now our directory structure is 1/2/3. Another developer decided to move everything up one level, so used git move to move 3 to 2, and removed 3, so now the level is 1/2. However, locally, all of my changes are in 1/2/3.
I want to commit my changes and merge them into the new directory structure. How would I go about doing that?
First, commit your changes. Then merge the other developer's changes. :)
We should probably point out to new people that "first commit and then worry about merges after your changes are safely committed" is always how people would "go about" anything.
Quoted 5 lines · Junio C Hamano
Quoted 1 line
First, commit your changes. Then merge the other developer's changes. :)
We should probably point out to new people that "first commit and then worry about merges after your changes are safely committed" is always how people would "go about" anything.
Yes, absolutely.
Most of the current documentation focuses on being a reference to particular commands or tasks. But this is more of a "philosophy of working with git" item. I guess it should go in the user manual somewhere. Cc'ing Bruce, who may have some comments.
-Peff
Quoted 8 lines · Jeff King
Quoted 5 lines · Junio C Hamano
Quoted 1 line
First, commit your changes. Then merge the other developer's changes. :)
We should probably point out to new people that "first commit and then worry about merges after your changes are safely committed" is always how people would "go about" anything.
Quoted 6 lines
Yes, absolutely.
Most of the current documentation focuses on being a reference to particular commands or tasks. But this is more of a "philosophy of working with git" item. I guess it should go in the user manual somewhere. Cc'ing Bruce, who may have some comments.
I agree, that's kind of an odd hold in the user manual. Maybe it goes without saying, but it might be useful somewhere in ch. 3, maybe when introducing commits, something along the lines of: "note all of these commits are stored only in your local repository, and are visible only to you. With some version control systems, "committing" requires sending the commit to a central server. With git, you are expected to do all your work locally and only merge with others' work when necessary; we'll learn how to do that in <chapter 4>."
And then say something similar again at the start of chapter 4?
--b.