git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* avoiding committing personal cruft
@ 2008-06-21 13:20 James Sadler
  2008-06-21 15:53 ` David
  0 siblings, 1 reply; 3+ messages in thread
From: James Sadler @ 2008-06-21 13:20 UTC (permalink / raw
  To: git

I couldn't think of a better subject, so bear with me while I explain.

Let's say I am contributing to some upstream project, and I am hacking on it
inside my local repo's master branch.  Let's also say that I enjoy
using my favourite IDE
which creates its own project files and whatnot, and I don't want to
commit that stuff with the
rest of the project code.  It has no place being accidentally
pushed/pulled upstream.  It's
my personal cruft, hence the subject line.

However, I *do* want to version control my personal cruft, and I can
do that on a separate
branch.  But I want the content of that other branch to exist in the
working tree alongside my
checkout of master.

My current solution basically involves versioning the IDE files on
another branch (named ide-branch),
and using 'git checkout ide-branch .' to overlay the files on top of
the currently checked-out branch (master).

The ide-branch has nothing in it except the cruft from the IDE and the
paths leading up to that cruft.
The master branch has a .gitignore that ignores the IDE files so I
won't end up polluting master by accident.

It's a manageable solution for now.  I tend to think of it
conceptually as 'layering' two branches: I want the
content of both present in the working tree.

I was just wondering if anyone else has tried something similar.


 James.



-- 
Calvin Coolidge  - "I have never been hurt by what I have not said."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: avoiding committing personal cruft
  2008-06-21 13:20 avoiding committing personal cruft James Sadler
@ 2008-06-21 15:53 ` David
       [not found]   ` <e5e204700806211901v17a0450fw56b9db1c8c578dd@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: David @ 2008-06-21 15:53 UTC (permalink / raw
  To: git

On Sat, Jun 21, 2008 at 3:20 PM, James Sadler <freshtonic@gmail.com> wrote:
>
> The ide-branch has nothing in it except the cruft from the IDE and the
> paths leading up to that cruft.
> The master branch has a .gitignore that ignores the IDE files so I
> won't end up polluting master by accident.
>
> It's a manageable solution for now.  I tend to think of it
> conceptually as 'layering' two branches: I want the
> content of both present in the working tree.
>
> I was just wondering if anyone else has tried something similar.
>

Sounds like a normal use of topic branches. Branches rebased against
master, where you you keep changes you don't want to go into the main
branch at this time.

David.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: avoiding committing personal cruft
       [not found]   ` <e5e204700806211901v17a0450fw56b9db1c8c578dd@mail.gmail.com>
@ 2008-06-22  7:58     ` David
  0 siblings, 0 replies; 3+ messages in thread
From: David @ 2008-06-22  7:58 UTC (permalink / raw
  To: James Sadler; +Cc: git

Re-cc-ing the list, I assume you didn't intend to mail me off-list.

On Sun, Jun 22, 2008 at 4:01 AM, James Sadler <freshtonic@gmail.com> wrote:
> 2008/6/22 David <wizzardx@gmail.com>:
>> On Sat, Jun 21, 2008 at 3:20 PM, James Sadler <freshtonic@gmail.com> wrote:
>>>
>>> The ide-branch has nothing in it except the cruft from the IDE and the
>>> paths leading up to that cruft.
>>> The master branch has a .gitignore that ignores the IDE files so I
>>> won't end up polluting master by accident.
>>>
>>> It's a manageable solution for now.  I tend to think of it
>>> conceptually as 'layering' two branches: I want the
>>> content of both present in the working tree.
>>>
>>> I was just wondering if anyone else has tried something similar.
>>>
>>
>> Sounds like a normal use of topic branches. Branches rebased against
>> master, where you you keep changes you don't want to go into the main
>> branch at this time.
>
> Just to clarify, are you saying that the topic branch would contain
> all of master + ide cruft?
> I was maintaining a branch that *only* contained my ide cruft.
>

More correctly, the topic branch would contain the changes to the
master branch required to add your personal cruft.

Here is one relatively simple way to do it (there are other ways, this
one works well for me when I have local cruft I want for local dev but
don't want in public repos):

Assuming you have these 2 branches:

master - clean & version, ready to be used by others)

james_updates - your own private cruft. work in progress, ide files,
etc, on top of the master branch. Not ready for others yet.

Do all your hacking, private commits, cruft updates, etc in the
james_updates branch. Also try to keep changes in separate commits (1
for cruft & personal files, 1 for feature change X, one for bugfix Y,
etc).

Later, when you are ready to move (some of the) changes over to the
master branch:

1) Make a temporary copy of the james_updates branch:

git checkout james_updates
git checkout -b james_updates_tmp

2) Interactively rebase the temporary branch over to master:

git rebase -i master

During the interactive rebase, you strip out the cruft commits,
reorder updates, etc, as necessary

3) After the rebase, test the new version. Make sure it compiles and
the new features work correctly. Run any automated tests.

4) Merge the temporary branch into master, and drop the temporary branch:

git checkout master
git merge james_updates_tmp
git branch -d james_updates_tmp

5) Rebase your (original) updates branch onto the updated master:

git checkout james_updates
git rebase master

Now you have a james_updates branch on top of master which only has
your cruft etc which you didn't merge earlier. The already-merged
commits are automatically removed from james_updates during the
rebase.

David.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-22  7:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-21 13:20 avoiding committing personal cruft James Sadler
2008-06-21 15:53 ` David
     [not found]   ` <e5e204700806211901v17a0450fw56b9db1c8c578dd@mail.gmail.com>
2008-06-22  7:58     ` David

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).