I have my personal small git repository on my laptop. I have just commited the changes and checked that I have nothing to commit - every staged and modified file has been commited.
After that I have copied all the files from this repo to another location and boom! I have uncommitted changes.
I believe I am missing some fundamental git rules. Can anyone suggest me on that ?
Git clone is used to copy an existing Git repository into a new local directory. The Git clone command will create a new local directory for the repository, copy all the contents of the specified repository, create the remote tracked branches, and checkout an initial branch locally.
Remove every file from Git's index. git rm --cached -r .
To do this without any headache: Check what's the current branch in the gitrepo1 with git status , let's say branch "development". Change directory to the newrepo, then git clone the project from repository. Switch branch in newrepo to the previous one: git checkout development .
You can copy it, everything is inside the . git folder and is not dependant on anything else. just cloned my whole dev-environment with 4 repos in it by simply copying it a few times and making each its own branch. worked flawlessly.
What I did, run
git diff | grep -B 2 @@ | grep +++
to get the actually changed files, then do revert on all others
Your files on windows probably have carriage-return line-feed line endings and you likely have core.autocrlf true on your windows box. Don't copy it like that between different platforms. Instead create a new git repository on the linux box and pull from the the Windows box. You can either use git bundle
or git daemon
on the Windows machine to expose the repository. Or you could make a bare repo on the linux box and git push --mirror
to it from the Windows machine then clone that where you want the final version to end up.
Or - quite likely you can already just do a git reset --hard HEAD
and fix it on the linux box as-is. Possibly you should delete everything except the .git folder first to ensure a completely clean working tree.
If you have nothing on stash to lose, do:
git checkout .
This will revert the working tree to your previous commit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With