git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Matthew McClure <matt@continuousdelta.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: How to track history of personal changes in a repository?
Date: Fri, 30 Aug 2019 08:21:17 -0700	[thread overview]
Message-ID: <CABPp-BEWn1wHdxWM8cVqmvzYo8HDdUzuh4G-XTN51o8JdvkrCw@mail.gmail.com> (raw)
In-Reply-To: <CAEV-cEp19ehfBwHxh7OGsvTxTchNJLSRZGZXqAsDjyQg-W3rFA@mail.gmail.com>

On Thu, Aug 29, 2019 at 10:58 AM Matthew McClure
<matt@continuousdelta.com> wrote:
>
> On Thu, Aug 29, 2019 at 1:04 PM Elijah Newren <newren@gmail.com> wrote:
> >
> > Perhaps put all the changes in a specific branch and run:
> >   git config branch.${personalBranchName}.pushRemote
> > Do.Not.Push.Changes.From.This.Branch
> > ?  (And make sure that push.default is not set to 'matching'.)
>
> I imagine putting all the changes on a specific branch might be part
> of a solution. I'm looking for ways to keep the changes in the work
> tree as well, even as I switch among other branches I'm working on.

Well, here's some ideas...

If you want personal changes kept in the worktree and aren't worried
about versioning them:

* If the changes are new files that are not tracked, just .gitignore them.
* If the changes are to files that are tracked, AND you aren't making
changes to those same files that do need to be committed and pushed,
use the assume-unchanged bit (see git-update-index(1)).
* If the changes are to files that are tracked and you need to make
other changes to those same files, the best you've probably got is "be
careful while using 'git add -p' to only select the bits that should
be staged".

If you want to keep the personal changes in the worktree AND are
worried about version control:

* You could just make sure that any personal changes are made in
separate commits of their own and put a special string (e.g. "DO NOT
PUSH") in the commit message.  Add a pre-push hook (see githooks) that
checks for this string in any of the commits to be pushed and denies
the push if it is found.  At that point, you'd just rebase to move the
"DO NOT PUSH" to be the last commits in the series, and always make
sure when pushing that you specify a commit older than the current tip
of your branch to push (i.e. using refspecs; see the git-push manpage)
* If you don't like the githook route and if the personal changes are
all in different filenames than exist in other branches, and you're
willing to do a little low-level hackery...then you could put all
these changes in a different branch as mentioned previously, and use
some low-level commands to "checkout" the files from both branches
simultaneously.  The basic way it'd work is that the real branch would
have a .gitignore for all files in your personal changes (whereas the
personal changes branch would have no .gitignore because files have to
be independent; things will just be uglier when you're on that
branch).  You'd use 'git symbolic-ref HEAD $OTHER_BRANCH && git reset'
to swap branches on the fly so you can commit different types of
changes.

Hope that helps,
Elijah

  reply	other threads:[~2019-08-30 15:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29 14:32 How to track history of personal changes in a repository? Matthew McClure
2019-08-29 17:04 ` Elijah Newren
2019-08-29 17:55   ` Matthew McClure
2019-08-30 15:21     ` Elijah Newren [this message]
2019-08-31 13:32       ` Philip Oakley
2019-09-03 12:57         ` Matthew McClure

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABPp-BEWn1wHdxWM8cVqmvzYo8HDdUzuh4G-XTN51o8JdvkrCw@mail.gmail.com \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=matt@continuousdelta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).