Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
639 views
in Technique[技术] by (71.8m points)

git - How to make changes that only i can see?

For example Id like to modify the login page, so it auto-logs me.

I want those changes to ONLY work on my development station and dont be visible in push. if I make it on a branch than i would have to somehow un-merge that change before every push.

is that supported by git?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you have at least Git 1.7.0, you might like this bit of ‘plumbing’:

git update-index --skip-worktree -- path

From the git update-index manpage under “Skip-worktree bit”:

Skip-worktree bit can be defined in one (long) sentence: When reading an entry, if it is marked as skip-worktree, then Git pretends its working directory version is up to date and read the index version instead.

To elaborate, "reading" means checking for file existence, reading file attributes or file content. The working directory version may be present or absent.

The “skip-worktree bit” is the basis for the sparse checkout mechanism documented in the git read-tree manpage`.


There is a related ‘bit’ in older versions of Git (git update-index --assume-unchanged), but it should not be used for the OP's purpose. It seems like it might be useful for the OP's situation, but Git's maintainer has said that its contract (the “promise”) makes it unsuitable for such purposes.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...