Re: Git documentation on branching.
- Date: Mon, 10 Apr 2017 12:45:33 +0200
- From: Samuel Åslund <samuel@xxxxxxxxxxxx>
- Subject: Re: Git documentation on branching.
On 17/4/10 12:21, Ævar Arnfjörð Bjarmason wrote:
On Mon, Apr 10, 2017 at 8:56 AM, Samuel Åslund <samuel@xxxxxxxxxxxx> wrote:
I just started playing around with branching in git.
I have been using it more or less as Subversion until now.
One feature with "git branch xyz" and "git checkout xyz" that is rather
obvious if you know them but bit me a little since I did not, is that
uncommitted work in progress is not affected or saved when switching between
branches. Thus I cleaned up the directory when working with the branch and
now I'm trying to find a stash where I hopefully have a copy of those files.
Would it be possible to add something in the documentation to warn others
that uncommitted work is not saved or affected by branching?
The main UI in git for switching branches is "git checkout", and it's
mentioned in the second paragraph of the documentation:
"[when switching branches] local modifications to the files in the
working tree are kept, so that they can be committed to the
Did you read this and find it unclear, and if so can you elaborate on
what the confusion was, maybe we can fix the docs with that in mind?
Or did you read some entirely different docs (what docs?) where we're
perhaps not mentioning this as prominently?
No, I did not read the git checkout manpage.
When I googled "git branch" I got the two pages mentioned below and this
Git - Basic Branching and Merging
I find that mostly manpages require some context before they are useful
so I go for the more wordy pages when trying to get my head around
something new. Neither of the three top-hits on google included the
local modifications comment where I noticed it. An actual search for
that string right now does not find anything either.
The comment you refer to in the git checkout man-page is probably enough
heads-up for someone who knows git reasonably well, I do not know if it
would have made me realize exactly how the feature works.
I'm not even sure I know how "local modifications" is defined in Git
terminology, does it include "(un)staged changes", and or untracked files?
Thanks for the attention.
The first two hits on my google search was very informative about branching
but I did not see that specific nugget of information (I might have been
careless reading, but if I did not see it others will probably also miss
Git - git-branch Documentation
Git - Branches in a Nutshell
This is my first try to contribute to the Git community, I hope it will be
useful to somebody.