logo
down
shadow

Git keeps resetting my files after a hard reset?


Git keeps resetting my files after a hard reset?

By : user2955335
Date : November 22 2020, 10:38 AM
wish helps you Don't version-control your config file.
Presumably you have modifications to your production.ini file that you want to keep, but which are sensitive and shouldn't be version controlled.
code :


Share : facebook icon twitter icon
How to git reset --hard everything but 4 files

How to git reset --hard everything but 4 files


By : Tom Mack
Date : March 29 2020, 07:55 AM
I wish this help you As you described the problem, it doesn't look like you want do reset. The simplest thing for this is:
code :
 git add app/models/a.rb app/views/a/index.html.rb config/foo.rb config/bar.rb
 git checkout .
Recover files in git after reset --hard on added files(not committed!)

Recover files in git after reset --hard on added files(not committed!)


By : Rubén Anaya
Date : March 29 2020, 07:55 AM
like below fixes the issue I have found the answer from stackoverflow only.
from: How can I undo git reset --hard HEAD~1?
code :
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (94312/94312), done.
dangling blob 34122c30800b0fd91bb8418efbbb230e75fe3dbe
dangling blob 0e25ccea407f3c19abc1433e5732a5f2a20191f6
dangling blob 90afe07d111640d86f02e09e4939d02bbf3f5d56
dangling blob e8b4dcb611257ddb13c29c09d39cc660a6bace02
dangling blob 3ad660983baa3608cd333daa8c6d9d47420d5e0b
dangling commit 8932f1f0c8df1917f38a6847a1f21fa54c6d6355
dangling blob 86548593d0f3337ecb7bc5d665a9f48148d9d157
dangling commit 6cf531cad6822132fd183e7e336a13f38d8fd8bd
dangling commit 0c025ebf3fe8d1632ec11b4734fb504deb06aa0a
dangling blob 6260329668086042177aab9f9a1e2a3720204bd8
dangling blob 887732bd14017d1d4558160e12a3666b131a9604
dangling blob f08e12e5724f7976f1596f963ac60e2ebd11b44c
dangling blob 079077a183e8450ab35670b92fd2ce6a8a4b7a9a
dangling commit 6dd8f3cddfc45340c6d0e0dc5fbaa2bd39b11fdb
dangling blob 1ee3ffc72b23bfcfc08dcc0fee8eac10cd4ea6e2
git show 34122c30800b0fd91bb8418efbbb230e75fe3dbe
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 1ee3ffc72b23bfcfc08dcc0fee8eac10cd4ea6e2 > /home/manan/Desktop/sample.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 079077a183e8450ab35670b92fd2ce6a8a4b7a9a > /home/manan/Desktop/sample1.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show f08e12e5724f7976f1596f963ac60e2ebd11b44c > /home/manan/Desktop/sample2.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 887732bd14017d1d4558160e12a3666b131a9604 > /home/manan/Desktop/sample3.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 6260329668086042177aab9f9a1e2a3720204bd8 > /home/manan/Desktop/sample4.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 0c025ebf3fe8d1632ec11b4734fb504deb06aa0a > /home/manan/Desktop/sample5.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 6cf531cad6822132fd183e7e336a13f38d8fd8bd > /home/manan/Desktop/sample6.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 86548593d0f3337ecb7bc5d665a9f48148d9d157 > /home/manan/Desktop/sample7.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 8932f1f0c8df1917f38a6847a1f21fa54c6d6355 > /home/manan/Desktop/sample8.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 3ad660983baa3608cd333daa8c6d9d47420d5e0b > /home/manan/Desktop/sample9.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show e8b4dcb611257ddb13c29c09d39cc660a6bace02 > /home/manan/Desktop/sample10.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 90afe07d111640d86f02e09e4939d02bbf3f5d56 > /home/manan/Desktop/sample11.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 0e25ccea407f3c19abc1433e5732a5f2a20191f6 > /home/manan/Desktop/sample12.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 34122c30800b0fd91bb8418efbbb230e75fe3dbe > /home/manan/Desktop/sample13.txt
manan@manan-pc:~/new_cms/abc/.git$ GIT_DIR! $ git show 6dd8f3cddfc45340c6d0e0dc5fbaa2bd39b11fdb > /home/manan/Desktop/sample14.txt
git reset --hard isn't resetting the files

git reset --hard isn't resetting the files


By : Bosun
Date : March 29 2020, 07:55 AM
help you fix your problem My guess is that this has to do with core.autocrlf changing your line endings. Have you tried with core.autocrlf=false?
You may have to delete and checkout the files again, or even try git tfs clone again from scratch with core.autocrlf=false (globally).
Does the index become empty or match the tracked files of the newly pointed commit, after resetting hard?

Does the index become empty or match the tracked files of the newly pointed commit, after resetting hard?


By : Lee
Date : March 29 2020, 07:55 AM
help you fix your problem It—git reset, with appropriate flags—fills the index from the commit to which you are re-setting.
Git makes this confusing because of the spelling of --allow-empty and --keep-empty flags (git commit, git rebase, and the like): these make it sound like the index is empty, when in fact the index simply matches the commit. It's the diff that's empty.
`git reset --hard` also reset ignored files?

`git reset --hard` also reset ignored files?


By : Nad
Date : March 29 2020, 07:55 AM
should help you out When you have already committed a file and ignored it afterwards, than you have to remove the file again in a separate commit.
When still want to use the file afterwards you should backup them beforehand.
code :
cp <file> <file>.bak
git rm --cached <file>
git commit -m 'Remove ignored file'
mv <file>.bak <file>
Related Posts Related Posts :
  • How do I give all GitLab users access to all repositories without making the repos public?
  • Unable to push file to git repository
  • Remove intermediate commit in Visual Studio Online
  • Why is Git committing the old version of a file?
  • git pull - will it fetch tags on remote by default?
  • Can I change my .gitignore at a remote site and will it push to GITHUB repro when I do a git push?
  • Git status upstream and downstream
  • Docker git clone on container launch?
  • How to get only YYYY-MM-DD output from git-log?
  • When you clone a repo like Laravel into an existing project do you pull it in as submodule even if you're not planning t
  • Git Source Control between two networks
  • Best practice for multiple vagrant boxes
  • What's the command to reset a file to a specific commit?
  • Git: do not create index.lock for read-only operations
  • Find the right parent of a merge commit in a non-interactive way
  • git push non for all the commits
  • bitbucket git commits missing
  • Git: Duplicates of files are created
  • Bash script globing error when doing a curl for custom Github CLI API with oAuth token header
  • troubling rebasing branch with merge conflics
  • Stash/branch/working copy confusion
  • How can I ignore all folders whose names are of the form <pattern>*?
  • Git syncing part of a branch with other branches
  • How to make code suggestion in github/bitbucket?
  • Change mail address in each commit
  • Inspecting branches with command line Git
  • Git distributed revision control and filetypes
  • Changing source control type in TFS 2013
  • How to use a new remote git repository when there is no access to old git repository?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org