Skip to main content
15 events
when toggle format what by license comment
Aug 27, 2018 at 10:48 comment added usr-local-ΕΨΗΕΛΩΝ The scope of a reformatter includes rearranging members, variables, namespace/package imports
Aug 26, 2018 at 18:29 comment added usr-local-ΕΨΗΕΛΩΝ @jrh in general any tool (including changes to braces) that is used to improve code readability without affecting the algorithm. Advanced IDEs can ignore pure whitespaces in conflict resolution
Aug 25, 2018 at 20:49 comment added jrh @usr-local-ΕΨΗΕΛΩΝ when you say "re-formatting" do you mean pure whitespace changes?
Aug 24, 2018 at 12:45 history edited usr-local-ΕΨΗΕΛΩΝ CC BY-SA 4.0
added 283 characters in body
Aug 22, 2018 at 22:46 comment added George M Reinstate Monica This answer is by far my favorite. But let me add @daisy that perhaps you're feeling overwhelmed because you're not using a good tool. Do you know about Sublime Text? It's immensely helpful in guiding you during merges, so you can clearly see what your own changes are and how they are affected by others. Check it out..
Aug 22, 2018 at 10:51 comment added usr-local-ΕΨΗΕΛΩΝ @max630 there is a caveat. If the reformat commit occurs at the end of your commit chain, you can easily discard that reformat commit and redo the format after rebase. Sometimes you feel the temptation of doing reformat in the middle of a long chain. When you rebase, you will see that the reformat commit is the most painful, so you choose to skip it. Unfortunately, the next commits will be all dependent on the previously done reformat, so your own code will start to raise plenties of conflicts. Whether theirs is the right choice depends on the specific repository, so use it wisely.
Aug 22, 2018 at 10:43 history edited usr-local-ΕΨΗΕΛΩΝ CC BY-SA 4.0
added 554 characters in body
Aug 21, 2018 at 13:18 comment added usr-local-ΕΨΗΕΛΩΝ From my C# culture, "re-formatting" means the action of formatting a whole code file or even entire repository where formatting is only related to readability. If your language uses whitespace meaningfully, you shouldn't mess with whitespaces in LOCs that are not your own. Conversely, your language of choice may still allow non-meaningful whitespaces (e.g. before a brace) that can be "reformatted" according to a readability standard
Aug 21, 2018 at 12:45 comment added Aaron M. Eshbach Since this question doesn't have a language specified, I'm not sure I agree with Do. Not. ABSOLUTELY. Reformat. In some languages, especially where whitespace is syntactically meaningful, reformatting is a lot less of a disaster and more common in day-to-day work.
Aug 21, 2018 at 7:16 comment added max630 You you feel a need to reformat or lightly refactor the code, do it before or after your meaningful commit. It will not only reduce conflicts, but also helps future reader of your commit, including reviewers
Aug 20, 2018 at 19:49 comment added jrh (I just found the old article), "Always check a module in cleaner than when you checked it out."; since what "module" means is rather unclear, I'd advise a strategy more like "Always improve the cleanliness of code that you are assigned to work on". that means that improving code that is used for a lot of stuff may have to wait until there is a coordinated team effort, but IMO that is better than constantly having conflicts to resolve.
Aug 20, 2018 at 19:35 comment added jrh Bob Martin readers should note that the Boy Scout Rule must be applied with restraint if you are working in a team (if you are working on your own, you have much more flexibility). If you interpret the rule as "It is my duty as a coder to fix literally everything in every file that isn't perfect the instant I find out about it, nevermind what anyone else is working on.", you will end up with a gigantic amount of hard to resolve conflicts, and it will be a giant mess no matter how good your intentions are.
Aug 20, 2018 at 18:32 comment added dgnuff Regarding reformatting, while VS can't do it automatically on save, if you set "When I paste" to "Indent and format" in "Tools" --> "Options" --> "Text Editor" --> "<Your language of choice>" --> "Formatting", that means it auto formats on paste. This allows the sequence of three keystrokes: ctrl-A, ctrl-C, ctrl-V to have the desired result. That said, +1 for Do. Not. ABSOLUTELY. Reformat. Except as you outline under very carefully controlled conditions.
Aug 20, 2018 at 3:39 comment added user622505 It is largely a matter of opinion, but I disagree that merge conflicts are easier to handle than rebase conflicts. When you rebase, you essentially apply commits one by one, keeping the scope of the merge conflicts much smaller and easier to follow (you apply YOUR changes that you know - not someone else's changes that you don't). You may have to solve more merge conflicts this way (due to touching the same files multiple times across commits), but they will be smaller and easier to tackle.
Aug 19, 2018 at 11:22 history answered usr-local-ΕΨΗΕΛΩΝ CC BY-SA 4.0