git commit best practices -


i using git manage c++ project. when working on projects, find hard organize changes commits when changing things related many places.

for example, may change class interface in .h file, affect corresponding .cpp file, , other files using it. not sure whether reasonable put stuff 1 big commit.

intuitively, think commits should modular, each 1 of them corresponds functional update/change, collaborators pick things accordingly. seems inevitable include lots of files , changes make functional change work.

searching did not yield me suggestion or tips. hence wonder if give me best practices when doing commits.

ps. i've been using git while , know how interactively add/rebase/split/amend/... asking philosophy part.

update: advices. maybe should learned practicing. keep problem open time see if there more suggestions.

i tend commit propose: commit logically connected change set. commits can one-liner change in files (for example add/change copyright notice in source files). reason change need not full task implementing, milestone in task.

if have modified not related current commit, tend interactive add separate out unrelated changes, - when whitespace tidy up.

i have found commits dump working state repository makes them lot less useful: cannot backport bugfix earlier version or include utility functionality in branch if commits on place.

one alternative approach using lot of tiny commits inside feature branch, , once whole feature done, heavy history rewriting tidy commits logical structure. find approach time waster.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -