[git-users] Re: Git says there are local changes, but there are no changes. (Windows)

2016-03-12 Thread Ben Page
It appears none of the commenters understands how git reset works. Even if 
the problem is that Visual Studio messed up the git index, git reset should 
fix it. And if Visual Studio messed up the file (line endings or 
otherwise), the git reset --hard should revert it. This is certainly a bug 
in git for windows.

On Tuesday, February 23, 2016 at 12:34:32 PM UTC-6, Ben Page wrote:
>
> I have a couple repos that routinely believe there are local changes, when 
> there are none. The only solution seems to be to delete these files 
> and reacquire them from git.
>
> For example:
>
> >git status
> On branch master
> Your branch is behind 'origin/master' by 2 commits, and can be 
> fast-forwarded.
>   (use "git pull" to update your local branch)
> Changes not staged for commit:
>   (use "git add ..." to update what will be committed)
>   (use "git checkout -- ..." to discard changes in working directory)
> modified: XXX
> modified: YYY
> no changes added to commit (use "git add" and/or "git commit -a")
>
> >git --version
> git version 2.7.2.windows.1
>
> Reset doesn't work.
>
> >git reset --hard
> HEAD is now at cebdb13 Commit Message
>
> >git pull 
> Updating cebdb13..076de5e
> error: Your local changes to the following files would be overwritten by 
> merge:
> XXX
> YYY
> Please, commit your changes or stash them before you can merge.
> Aborting
>
> Checkout doesn't work
>
> >git checkout XXX
> >git checkout YYY
>
> >git pull
> Updating cebdb13..076de5e
> error: Your local changes to the following files would be overwritten by 
> merge:
> XXX
> Please, commit your changes or stash them before you can merge.
> Aborting
>
> The only solution that I've found .
> >rm .git\index
> >rm XXX
> >rm YYY
> >git reset --hard
> >git pull
> Updating cebdb13..076de5e
> Fast-forward
> ...
>
> Can anyone help me understand why this is happening and how to avoid it?
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Git says there are local changes, but there are no changes. (Windows)

2016-03-12 Thread Ben Page
No, you do not.

On Friday, March 11, 2016 at 1:55:27 AM UTC-6, tombert wrote:
>
> you need to do a "git checkout ." in order to overwrite local changes 
> (note the dot after the checkout command).
>
> On Friday, 4 March 2016 22:05:19 UTC+1, Ben Page wrote:
>>
>> The repos that exhibit this behavior are Visual Studio projects and the 
>> problem files are text files.
>>
>> I don't think the problem is line endings. git diff returns nothing and 
>> the projects have * text=auto in the .gitattributes file and 
>> core.autocrlf set to true.
>>
>> I believe the problem is caused by Visual Studio. This never happens on 
>> any project that doesn't use it. But I don't know what it's doing to the 
>> files.
>>
>> What I'm most confused by is why doesn't git checkout or git reset --hard 
>> resolve 
>> the problem. Why do I have to delete the .git\index for git to properly 
>> recreate these file?
>>
>> On Wednesday, February 24, 2016 at 10:03:24 AM UTC-6, Dale R. Worley 
>> wrote:
>>>
>>> Ben Page  writes: 
>>> >>git status 
>>> > On branch master 
>>> > Your branch is behind 'origin/master' by 2 commits, and can be 
>>> > fast-forwarded. 
>>> >   (use "git pull" to update your local branch) 
>>> > Changes not staged for commit: 
>>> >   (use "git add ..." to update what will be committed) 
>>> >   (use "git checkout -- ..." to discard changes in working 
>>> directory) 
>>> > modified: XXX 
>>> > modified: YYY 
>>> > no changes added to commit (use "git add" and/or "git commit -a") 
>>>
>>> Certainly one thing you can do is "git diff XX" and see what Git 
>>> thinks the changes are. 
>>>
>>> Unfortunately, I don't know if git-diff is completely rigid about 
>>> reporting different ends-of-lines.  You can 
>>> mv XX XX.old 
>>> git reset --hard 
>>> diff XX XX.old 
>>> if you know that the diff you are using reports all byte differences. 
>>>
>>> As the other responder said, the underlying cause is likely file name 
>>> casing or ends-of-lines, which are the sort of things that get 
>>> translated between files in the working directory and the repository. 
>>>
>>> Dale 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Stash Apply - Verify Workflow

2016-03-12 Thread Dok
Hey Y'all

I've inherited a project managed by GIT and checked out the development 
base branch (I'll call it '*bridge*') to where work is to be done. Added a 
file or two, fixed a few things and removed some others. Now the project 
manager would like me to commit these changes to a different bug branch 
(I'll call it 'b003')... uuuhhh... OK

Not be an expert by any means, here's my thoughts for a workflow:

First, '*git stash*' anything/everything I've done locally. Then, 
re-checkout the 'bridge' (*git checkout bridge*) development base, create 
and checkout the bug branch (git checkout -b b003), publish (git publish 
b003) and then apply the stash (*git stash apply*) to get the files I 
worked into the new bug branch b003. That should put me into the position 
to get everything I've worked on into a staged for commit state, and then 
commit all changes and push everything to the repository (git push origin 
b003). Sorry for the verbosity, in recap :

*[923]-userame@localhost~$ git stash*

*[923]-userame@localhost~$ git checkout bridge*

*[923]-userame@localhost~$ git checkout -b b003*

*[923]-userame@localhost~$ git publish b003*

*[923]-userame@localhost~$ git stash apply*

*[923]-userame@localhost~$ git {various adds & commits of applied stash 
changes}*

*[923]-userame@localhost~$ git push origin b003*

Does that look to be a correct course of action? Any thoughts, input, 
constructive criticisms etc all welcome and appreciated!

Thanx in advance...

Peace
--
Dok

*"Too many guitars is just about right..." - [Anonymous Player]*




-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.