New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local unrevertable changes after cloning repository #731

Closed
aistomin opened this Issue Apr 17, 2014 · 20 comments

Comments

Projects
None yet
4 participants
@aistomin
Contributor

aistomin commented Apr 17, 2014

I have some troubles with my local repository. I've some files with changes that I can not revert and can not see the difference. Probably it's the .gitattributes file have some conflict with my local git configuration.
I have the following calling git status:

aistomin@istomin-new-workstation:~/projects/tpc2/forks/jcabi-github$ git status                                                                                                                                                                              
# On branch master                                                                                                                                                                                                                                                             
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   src/it/basic-usage/src/test/java/com/jcabi/foo/SampleTest.java
#       modified:   src/main/java/com/jcabi/github/Bulk.java
#       modified:   src/main/java/com/jcabi/github/Forks.java
#       modified:   src/main/java/com/jcabi/github/PublicKey.java
#       modified:   src/main/java/com/jcabi/github/PublicKeys.java
#       modified:   src/main/java/com/jcabi/github/RtComment.java
#       modified:   src/main/java/com/jcabi/github/RtCommit.java
#       modified:   src/main/java/com/jcabi/github/RtEvent.java
#       modified:   src/main/java/com/jcabi/github/RtForks.java
#       modified:   src/main/java/com/jcabi/github/RtIssue.java
#       modified:   src/main/java/com/jcabi/github/RtJson.java
#       modified:   src/main/java/com/jcabi/github/RtLabel.java
#       modified:   src/main/java/com/jcabi/github/RtLimit.java
#       modified:   src/main/java/com/jcabi/github/RtLimits.java
#       modified:   src/main/java/com/jcabi/github/RtPagination.java
#       modified:   src/main/java/com/jcabi/github/RtPublicKey.java
#       modified:   src/main/java/com/jcabi/github/RtPublicKeys.java
#       modified:   src/main/java/com/jcabi/github/RtPull.java
#       modified:   src/main/java/com/jcabi/github/RtRepos.java
#       modified:   src/main/java/com/jcabi/github/RtUsers.java
#       modified:   src/main/java/com/jcabi/github/Search.java
#       modified:   src/main/java/com/jcabi/github/mock/MkComment.java
#       modified:   src/main/java/com/jcabi/github/mock/MkForks.java
#       modified:   src/main/java/com/jcabi/github/mock/MkIssue.java
#       modified:   src/main/java/com/jcabi/github/mock/MkPublicKey.java
#       modified:   src/main/java/com/jcabi/github/mock/MkPublicKeys.java
#       modified:   src/main/java/com/jcabi/github/mock/MkPull.java
#       modified:   src/test/java/com/jcabi/github/BulkTest.java
#       modified:   src/test/java/com/jcabi/github/PublicKeyTest.java
#       modified:   src/test/java/com/jcabi/github/RtCommentTest.java
#       modified:   src/test/java/com/jcabi/github/RtEventTest.java
#       modified:   src/test/java/com/jcabi/github/RtForksITCase.java
#       modified:   src/test/java/com/jcabi/github/RtForksTest.java
#       modified:   src/test/java/com/jcabi/github/RtGithubITCase.java
#       modified:   src/test/java/com/jcabi/github/RtGithubTest.java
#       modified:   src/test/java/com/jcabi/github/RtIssueITCase.java
#       modified:   src/test/java/com/jcabi/github/RtIssueLabelsITCase.java
#       modified:   src/test/java/com/jcabi/github/RtIssueTest.java
#       modified:   src/test/java/com/jcabi/github/RtIssuesITCase.java
#       modified:   src/test/java/com/jcabi/github/RtLabelsITCase.java
#       modified:   src/test/java/com/jcabi/github/RtLimitsITCase.java
#       modified:   src/test/java/com/jcabi/github/RtMarkdownITCase.java
#       modified:   src/test/java/com/jcabi/github/RtMarkdownTest.java
#       modified:   src/test/java/com/jcabi/github/RtOrganizationTest.java
#       modified:   src/test/java/com/jcabi/github/RtPublicKeyTest.java
#       modified:   src/test/java/com/jcabi/github/RtPublicKeysTest.java
#       modified:   src/test/java/com/jcabi/github/RtPullTest.java
#       modified:   src/test/java/com/jcabi/github/RtUserITCase.java
#       modified:   src/test/java/com/jcabi/github/mock/MkForksTest.java
#       modified:   src/test/java/com/jcabi/github/mock/MkPublicKeyTest.java
#       modified:   src/test/java/com/jcabi/github/mock/MkPublicKeysTest.java
#       modified:   src/test/java/com/jcabi/github/mock/MkPullTest.java

calling git config --list I get this:

aistomin@istomin-new-workstation:~/projects/tpc2/forks/jcabi-github$ git config --list
user.name=aistomin
user.email=andrej.istomin.ikeen@gmail.com
core.autocrlf=true
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.autocrlf=true
remote.origin.url=git@github.com:aistomin/jcabi-github.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

Have you any ideas what I'm doing wrong? I tried to googling but didn't get it working. I tried to make new fork and clone it... but got the same result. Could somebody help me, please..? I can not work and commit something because of this trouble.

@aistomin aistomin changed the title from Local changes after cloning repository to Local unrevertable changes after cloning repository Apr 17, 2014

@yegor256

This comment has been minimized.

Show comment
Hide comment
@yegor256

yegor256 Apr 17, 2014

Member

looks like the bug a few people are having recently with our repo, thanks for reporting

Member

yegor256 commented Apr 17, 2014

looks like the bug a few people are having recently with our repo, thanks for reporting

@yegor256

This comment has been minimized.

Show comment
Hide comment
@yegor256

yegor256 Apr 17, 2014

Member

@dmarkov please pay for this report

Member

yegor256 commented Apr 17, 2014

@dmarkov please pay for this report

@yegor256

This comment has been minimized.

Show comment
Hide comment
@yegor256

yegor256 Apr 17, 2014

Member

@dmarkov please assign @carlosmiranda to this issue

Member

yegor256 commented Apr 17, 2014

@dmarkov please assign @carlosmiranda to this issue

@yegor256 yegor256 added the bug label Apr 17, 2014

@aistomin

This comment has been minimized.

Show comment
Hide comment
@aistomin

aistomin Apr 17, 2014

Contributor

@dmarkov @yegor256 @carlosmiranda My OS version:

aistomin@istomin-new-workstation:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 13.10
Release:        13.10
Codename:       saucy

Maybe it will help...

Contributor

aistomin commented Apr 17, 2014

@dmarkov @yegor256 @carlosmiranda My OS version:

aistomin@istomin-new-workstation:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 13.10
Release:        13.10
Codename:       saucy

Maybe it will help...

@dmarkov

This comment has been minimized.

Show comment
Hide comment
@dmarkov

dmarkov Apr 17, 2014

I'll find a developer for the task soon...

dmarkov commented Apr 17, 2014

I'll find a developer for the task soon...

@dmarkov

This comment has been minimized.

Show comment
Hide comment
@dmarkov

dmarkov Apr 17, 2014

@dmarkov please pay for this report

@yegor256 yes, will do. @aistomin thank you for this ticket, your account was topped up for 15 mins, transaction ID: 8204453

dmarkov commented Apr 17, 2014

@dmarkov please pay for this report

@yegor256 yes, will do. @aistomin thank you for this ticket, your account was topped up for 15 mins, transaction ID: 8204453

@dmarkov

This comment has been minimized.

Show comment
Hide comment
@dmarkov

dmarkov Apr 17, 2014

@dmarkov please assign @carlosmiranda to this issue

@yegor256 yep, done. @carlosmiranda it's your task now

dmarkov commented Apr 17, 2014

@dmarkov please assign @carlosmiranda to this issue

@yegor256 yep, done. @carlosmiranda it's your task now

@carlosmiranda

This comment has been minimized.

Show comment
Hide comment
@carlosmiranda

carlosmiranda Apr 17, 2014

Contributor

@aistomin , try setting your core.autocrlf to false and doing a clean checkout.

Contributor

carlosmiranda commented Apr 17, 2014

@aistomin , try setting your core.autocrlf to false and doing a clean checkout.

@aistomin

This comment has been minimized.

Show comment
Hide comment
@aistomin

aistomin Apr 18, 2014

Contributor

@carlosmiranda I'd changed the setting you said and made clone again. Unfortunately, seems that problem remains the same:

aistomin@istomin-new-workstation:~/projects/tpc2/forks/jcabi-github$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   src/it/basic-usage/src/test/java/com/jcabi/foo/SampleTest.java
        modified:   src/main/java/com/jcabi/github/Bulk.java
        modified:   src/main/java/com/jcabi/github/Forks.java
        modified:   src/main/java/com/jcabi/github/PublicKey.java
        modified:   src/main/java/com/jcabi/github/PublicKeys.java
        modified:   src/main/java/com/jcabi/github/RtComment.java
        modified:   src/main/java/com/jcabi/github/RtCommit.java
        modified:   src/main/java/com/jcabi/github/RtEvent.java
        modified:   src/main/java/com/jcabi/github/RtForks.java
        modified:   src/main/java/com/jcabi/github/RtIssue.java
        modified:   src/main/java/com/jcabi/github/RtJson.java
        modified:   src/main/java/com/jcabi/github/RtLabel.java
        modified:   src/main/java/com/jcabi/github/RtLimit.java
        modified:   src/main/java/com/jcabi/github/RtLimits.java
        modified:   src/main/java/com/jcabi/github/RtPagination.java
        modified:   src/main/java/com/jcabi/github/RtPublicKey.java
        modified:   src/main/java/com/jcabi/github/RtPublicKeys.java
        modified:   src/main/java/com/jcabi/github/RtPull.java
        modified:   src/main/java/com/jcabi/github/RtRepos.java
        modified:   src/main/java/com/jcabi/github/RtUsers.java
        modified:   src/main/java/com/jcabi/github/Search.java
        modified:   src/main/java/com/jcabi/github/mock/MkComment.java
        modified:   src/main/java/com/jcabi/github/mock/MkForks.java
        modified:   src/main/java/com/jcabi/github/mock/MkIssue.java
        modified:   src/main/java/com/jcabi/github/mock/MkPublicKey.java
        modified:   src/main/java/com/jcabi/github/mock/MkPublicKeys.java
        modified:   src/main/java/com/jcabi/github/mock/MkPull.java
        modified:   src/test/java/com/jcabi/github/BulkTest.java
        modified:   src/test/java/com/jcabi/github/PublicKeyTest.java
        modified:   src/test/java/com/jcabi/github/RtCommentTest.java
        modified:   src/test/java/com/jcabi/github/RtEventTest.java
        modified:   src/test/java/com/jcabi/github/RtForksITCase.java
        modified:   src/test/java/com/jcabi/github/RtForksTest.java
        modified:   src/test/java/com/jcabi/github/RtGithubITCase.java
        modified:   src/test/java/com/jcabi/github/RtGithubTest.java
        modified:   src/test/java/com/jcabi/github/RtIssueITCase.java
        modified:   src/test/java/com/jcabi/github/RtIssueLabelsITCase.java
        modified:   src/test/java/com/jcabi/github/RtIssueTest.java
        modified:   src/test/java/com/jcabi/github/RtIssuesITCase.java
        modified:   src/test/java/com/jcabi/github/RtLabelsITCase.java
        modified:   src/test/java/com/jcabi/github/RtLimitsITCase.java
        modified:   src/test/java/com/jcabi/github/RtMarkdownITCase.java
        modified:   src/test/java/com/jcabi/github/RtMarkdownTest.java
        modified:   src/test/java/com/jcabi/github/RtOrganizationTest.java
        modified:   src/test/java/com/jcabi/github/RtPublicKeyTest.java
        modified:   src/test/java/com/jcabi/github/RtPublicKeysTest.java
        modified:   src/test/java/com/jcabi/github/RtPullTest.java
        modified:   src/test/java/com/jcabi/github/RtUserITCase.java
        modified:   src/test/java/com/jcabi/github/mock/MkForksTest.java
        modified:   src/test/java/com/jcabi/github/mock/MkPublicKeyTest.java
        modified:   src/test/java/com/jcabi/github/mock/MkPublicKeysTest.java
        modified:   src/test/java/com/jcabi/github/mock/MkPullTest.java

no changes added to commit (use "git add" and/or "git commit -a")

Git configured as following:

aistomin@istomin-new-workstation:~/projects/tpc2/forks/jcabi-github$ git config --list
user.name=aistomin
user.email=andrej.istomin.ikeen@gmail.com
core.autocrlf=false
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:aistomin/jcabi-github.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
aistomin@istomin-new-workstation:~/projects/tpc2/forks/jcabi-github$ 

Contributor

aistomin commented Apr 18, 2014

@carlosmiranda I'd changed the setting you said and made clone again. Unfortunately, seems that problem remains the same:

aistomin@istomin-new-workstation:~/projects/tpc2/forks/jcabi-github$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   src/it/basic-usage/src/test/java/com/jcabi/foo/SampleTest.java
        modified:   src/main/java/com/jcabi/github/Bulk.java
        modified:   src/main/java/com/jcabi/github/Forks.java
        modified:   src/main/java/com/jcabi/github/PublicKey.java
        modified:   src/main/java/com/jcabi/github/PublicKeys.java
        modified:   src/main/java/com/jcabi/github/RtComment.java
        modified:   src/main/java/com/jcabi/github/RtCommit.java
        modified:   src/main/java/com/jcabi/github/RtEvent.java
        modified:   src/main/java/com/jcabi/github/RtForks.java
        modified:   src/main/java/com/jcabi/github/RtIssue.java
        modified:   src/main/java/com/jcabi/github/RtJson.java
        modified:   src/main/java/com/jcabi/github/RtLabel.java
        modified:   src/main/java/com/jcabi/github/RtLimit.java
        modified:   src/main/java/com/jcabi/github/RtLimits.java
        modified:   src/main/java/com/jcabi/github/RtPagination.java
        modified:   src/main/java/com/jcabi/github/RtPublicKey.java
        modified:   src/main/java/com/jcabi/github/RtPublicKeys.java
        modified:   src/main/java/com/jcabi/github/RtPull.java
        modified:   src/main/java/com/jcabi/github/RtRepos.java
        modified:   src/main/java/com/jcabi/github/RtUsers.java
        modified:   src/main/java/com/jcabi/github/Search.java
        modified:   src/main/java/com/jcabi/github/mock/MkComment.java
        modified:   src/main/java/com/jcabi/github/mock/MkForks.java
        modified:   src/main/java/com/jcabi/github/mock/MkIssue.java
        modified:   src/main/java/com/jcabi/github/mock/MkPublicKey.java
        modified:   src/main/java/com/jcabi/github/mock/MkPublicKeys.java
        modified:   src/main/java/com/jcabi/github/mock/MkPull.java
        modified:   src/test/java/com/jcabi/github/BulkTest.java
        modified:   src/test/java/com/jcabi/github/PublicKeyTest.java
        modified:   src/test/java/com/jcabi/github/RtCommentTest.java
        modified:   src/test/java/com/jcabi/github/RtEventTest.java
        modified:   src/test/java/com/jcabi/github/RtForksITCase.java
        modified:   src/test/java/com/jcabi/github/RtForksTest.java
        modified:   src/test/java/com/jcabi/github/RtGithubITCase.java
        modified:   src/test/java/com/jcabi/github/RtGithubTest.java
        modified:   src/test/java/com/jcabi/github/RtIssueITCase.java
        modified:   src/test/java/com/jcabi/github/RtIssueLabelsITCase.java
        modified:   src/test/java/com/jcabi/github/RtIssueTest.java
        modified:   src/test/java/com/jcabi/github/RtIssuesITCase.java
        modified:   src/test/java/com/jcabi/github/RtLabelsITCase.java
        modified:   src/test/java/com/jcabi/github/RtLimitsITCase.java
        modified:   src/test/java/com/jcabi/github/RtMarkdownITCase.java
        modified:   src/test/java/com/jcabi/github/RtMarkdownTest.java
        modified:   src/test/java/com/jcabi/github/RtOrganizationTest.java
        modified:   src/test/java/com/jcabi/github/RtPublicKeyTest.java
        modified:   src/test/java/com/jcabi/github/RtPublicKeysTest.java
        modified:   src/test/java/com/jcabi/github/RtPullTest.java
        modified:   src/test/java/com/jcabi/github/RtUserITCase.java
        modified:   src/test/java/com/jcabi/github/mock/MkForksTest.java
        modified:   src/test/java/com/jcabi/github/mock/MkPublicKeyTest.java
        modified:   src/test/java/com/jcabi/github/mock/MkPublicKeysTest.java
        modified:   src/test/java/com/jcabi/github/mock/MkPullTest.java

no changes added to commit (use "git add" and/or "git commit -a")

Git configured as following:

aistomin@istomin-new-workstation:~/projects/tpc2/forks/jcabi-github$ git config --list
user.name=aistomin
user.email=andrej.istomin.ikeen@gmail.com
core.autocrlf=false
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:aistomin/jcabi-github.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
aistomin@istomin-new-workstation:~/projects/tpc2/forks/jcabi-github$ 

@carlosmiranda

This comment has been minimized.

Show comment
Hide comment
@carlosmiranda

carlosmiranda Apr 18, 2014

Contributor

By any chance would your editor be set to using Windows-style CR+LF line endings?

Contributor

carlosmiranda commented Apr 18, 2014

By any chance would your editor be set to using Windows-style CR+LF line endings?

@carlosmiranda

This comment has been minimized.

Show comment
Hide comment
@carlosmiranda

carlosmiranda Apr 18, 2014

Contributor

Another possibility is that your fork has CR+LF line endings committed. You may need to renormalize it - check https://help.github.com/articles/dealing-with-line-endings for details.

Contributor

carlosmiranda commented Apr 18, 2014

Another possibility is that your fork has CR+LF line endings committed. You may need to renormalize it - check https://help.github.com/articles/dealing-with-line-endings for details.

@aistomin

This comment has been minimized.

Show comment
Hide comment
@aistomin

aistomin Apr 18, 2014

Contributor

@carlosmiranda My fork has no any commits except those that are present in common repo. When I got this trouble I made new clean fork without any additional commits.

Contributor

aistomin commented Apr 18, 2014

@carlosmiranda My fork has no any commits except those that are present in common repo. When I got this trouble I made new clean fork without any additional commits.

@carlosmiranda

This comment has been minimized.

Show comment
Hide comment
@carlosmiranda

carlosmiranda Apr 18, 2014

Contributor

Okay, then I'm not sure what's going on here. Could you try renormalizing your fork anyway, and see what happens?

Contributor

carlosmiranda commented Apr 18, 2014

Okay, then I'm not sure what's going on here. Could you try renormalizing your fork anyway, and see what happens?

@aistomin

This comment has been minimized.

Show comment
Hide comment
@aistomin

aistomin Apr 18, 2014

Contributor

@carlosmiranda Could you explain please what do you mean "renormalizing" and how to do it? :)

Contributor

aistomin commented Apr 18, 2014

@carlosmiranda Could you explain please what do you mean "renormalizing" and how to do it? :)

@carlosmiranda

This comment has been minimized.

Show comment
Hide comment
@carlosmiranda

carlosmiranda Apr 18, 2014

Contributor

Basically, you remove all changes, do a hard reset, add all files in the repo and make a new commit. Note that you shouldn't have to merge the commit with our upstream repo jcabi/jcabi-github, but your fork should be fixed and you should be able to work from there.

Check the link I posted in an above post. For your convenience the steps are the following:

git rm --cached -r .
# Remove everything from the index.

git reset --hard
# Write both the index and working directory from git's database.

git add .
# Prepare to make a commit by staging all the files that will get normalized.
# This is your chance to inspect which files were never normalized. You should
# get lots of messages like: "warning: CRLF will be replaced by LF in file."

git commit -m "Normalize line endings"
# Commit
Contributor

carlosmiranda commented Apr 18, 2014

Basically, you remove all changes, do a hard reset, add all files in the repo and make a new commit. Note that you shouldn't have to merge the commit with our upstream repo jcabi/jcabi-github, but your fork should be fixed and you should be able to work from there.

Check the link I posted in an above post. For your convenience the steps are the following:

git rm --cached -r .
# Remove everything from the index.

git reset --hard
# Write both the index and working directory from git's database.

git add .
# Prepare to make a commit by staging all the files that will get normalized.
# This is your chance to inspect which files were never normalized. You should
# get lots of messages like: "warning: CRLF will be replaced by LF in file."

git commit -m "Normalize line endings"
# Commit
@aistomin

This comment has been minimized.

Show comment
Hide comment
@aistomin

aistomin Apr 18, 2014

Contributor

@carlosmiranda "Note that you shouldn't have to merge the commit with our upstream repo jcabi/jcabi-github" - does it mean that I must not include this commit in future pull requests?

Contributor

aistomin commented Apr 18, 2014

@carlosmiranda "Note that you shouldn't have to merge the commit with our upstream repo jcabi/jcabi-github" - does it mean that I must not include this commit in future pull requests?

@carlosmiranda

This comment has been minimized.

Show comment
Hide comment
@carlosmiranda

carlosmiranda Apr 18, 2014

Contributor

@aistomin , not necessarily. It just means that if it's fixed, you can proceed working on your local repo, without having to merge into the upstream repo first. I believe this is a local repo issue, since some of us are experiencing it and some aren't. Don't worry about including the commit in your future branches, the normalization should be consistent with upstream.

Contributor

carlosmiranda commented Apr 18, 2014

@aistomin , not necessarily. It just means that if it's fixed, you can proceed working on your local repo, without having to merge into the upstream repo first. I believe this is a local repo issue, since some of us are experiencing it and some aren't. Don't worry about including the commit in your future branches, the normalization should be consistent with upstream.

@aistomin

This comment has been minimized.

Show comment
Hide comment
@aistomin

aistomin Apr 18, 2014

Contributor

@carlosmiranda Great. So, I've done what you told and seems that now everything is fine for me. Thank you very much for your help, closing this issue...

Contributor

aistomin commented Apr 18, 2014

@carlosmiranda Great. So, I've done what you told and seems that now everything is fine for me. Thank you very much for your help, closing this issue...

@aistomin aistomin closed this Apr 18, 2014

@carlosmiranda

This comment has been minimized.

Show comment
Hide comment
@carlosmiranda

carlosmiranda Apr 18, 2014

Contributor

@aistomin You're most welcome. :)

Contributor

carlosmiranda commented Apr 18, 2014

@aistomin You're most welcome. :)

@dmarkov

This comment has been minimized.

Show comment
Hide comment
@dmarkov

dmarkov Apr 18, 2014

@carlosmiranda 30 mins added to your account (payment number 38510557), many thanks for your contribution!

dmarkov commented Apr 18, 2014

@carlosmiranda 30 mins added to your account (payment number 38510557), many thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment