git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: refactoring in GIT

From
CKChristof Krüger <git@christof-krueger.de>
Date
Jun 28, 2011, 15:59 UTC
Message-ID
<1a25cfcef173d20a259950d6829b2611.squirrel@mail.localhost.li>
In-Reply-To
<loom.20110628T151105-908@post.gmane.org>
Hi Eugene
Show 5 quoted lines
> #1. I want to refactor class A into few classes B,C,D. How should I check
> them
> in and mark class A inactive so that development on A stops? Note, I do
> need A
> stay in repository for backward compt. with prior code releases.

Well, if you really need to keep that file, how about a huge comment at the beginning of the file? Or move its content somewhere else and #include it from the original file. Git really can't help you here. This is a communication issue within your project. Resulting from its distributed design git does not have a global "lock" feature that could be misused for that matter.

Show 5 quoted lines
> #2. [related question] What if another developer already had A in his
> local
> repository, made changes and wants to commit after me. I just made A
> obsolete.
> Does he have drop his changes and take B,C,D from me and/or merge?

Git can't help you here either. If your changes don't conflict with their changes, they won't notice if they do not examine your changes. This again is a communication/coordination issue, not a git one. However, if you had moved "A" away or changed every line, the other developers would get a conflict when trying to pull your stuff.

Further, git obviously won't automatically refactor other developers code to match your changes. Depending on the complexity of your refactoring, you might be able to play around with patches manually.

The least thing you can do is to inform the other developers about your changes and apologize for not telling them that you planned to make A obsolete in advance ;)

Previous: Massimo MancaNext: Fredrik Gustafsson
Message 3 of 4 in “refactoring in GIT”
  1. eugeneJun 28, 2011
  2. Massimo MancaJun 28, 2011
  3. Christof KrügerJun 28, 2011
  4. Fredrik GustafssonJun 28, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.