git hell

git hell

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

git hell

Post by AF »

Im trying to meddle around with git, and runnign into issues. As simple as people made it out to be, its not at all. Line endings!!!!! pfft

Right now my ntai/ntai branch is borked,I made a change that resulted in a file turning to all windows line endings. As a result hoijui cant merge with spring master, and I cant fix in another commit, because gitgui knows the file has changed but cant see a differenc ein the content resulting in a never ending loop of rescan -> error dialog -> rescan-> error dialog etc

How do I fix? And how do I prevent it happening again?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: git hell

Post by lurker »

what's your current git config core.autocrlf?
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: git hell

Post by imbaczek »

that's one of the parts that are broken in git. you need to do switch core.autocrlf to input or false and reset/checkout again.

Code: Select all

git config core.autocrlf false
git reset --hard OR git checkout back and forth across branches
preventing from happening is easy - once you merged your changes with whatever there is changed, commit the suggested whole-file diff.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: git hell

Post by AF »

hmm should that be set to true not false? I'd done that though I hadnt reset and Id already committed the change to my repo so now theres mixed line endings in one file
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: git hell

Post by lurker »

True means it write out crlf all the time. True is very bad.
Where did you commit? The main spring repo or a fork? If just a fork you can alter history a bit and undo that commit.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: git hell

Post by AF »

Im trying to undo the commit btu I dont know how, Ill set to false
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: git hell

Post by AF »

Okay Im now at the revision where the line endings borked and gitgui shows no changes how do I undo the commit?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: git hell

Post by lurker »

git reset --soft HEAD^
undoes one commit into the working dir
git reset --hard
cleans out the working dir
git push --force
CHECK IN GITK FIRST
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: git hell

Post by AF »

User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: git hell

Post by AF »

It onyl appears to have taken effect locally
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: git hell

Post by lurker »

What did it say when you ran push?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: git hell

Post by AF »

Code: Select all

AF-Standard@AF-PC /d/media/documents/Development/git_repos/ntairepos/ntai
$ git push --force
Everything up-to-date

AF-Standard@AF-PC /d/media/documents/Development/git_repos/ntairepos/ntai
$
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: git hell

Post by lurker »

screenshot of gitk --all?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: git hell

Post by AF »

here:
Attachments
gitk.jpg
(161.41 KiB) Downloaded 24 times
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: git hell

Post by lurker »

git status?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: git hell

Post by AF »

Code: Select all

AF-Standard@AF-PC /d/media/documents/Development/git_repos/ntairepos/ntai
$ git status
# On branch origin/ntai
nothing to commit (working directory clean)

AF-Standard@AF-PC /d/media/documents/Development/git_repos/ntairepos/ntai
$
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: git hell

Post by lurker »

Maybe you have to make the new, fixed, commit first.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: git hell

Post by AF »

so redo my change, change the file to linux endings and commit?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: git hell

Post by lurker »

If you set autocrlf to false, the older version of the file should already have unix endings.
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: git hell

Post by Auswaschbar »

Wth a little bit of git and dos2unix magic, I commited your change, so you can just drop it and do it right next time.
Post Reply

Return to “Engine”