简体   繁体   中英

i deleted a commit file from work repo and i want to get back it from local repo in GIT

i deleted a commit file from working repo but the file is available in local repo in GIT and file is not available in remote repo as well.

now my question is how we can get that deleted file that is available in local repo but not in work repo.

Repo =repository

Thanks

If the file is stored in a previours commit in the history of the repo, restoring it to its value in that previous commit is a simple:

git checkout <commit sha1> -- path/to/file

The "zone" where files are added before being committed is called: the index.

If you want to get a file back from the index:

git checkout -- path/to/file

Simple steps:

  1. Take backup of that file in local.
  2. Make up to date your local repository.
  3. Add that file in you directory.
  4. Commit your new file and push the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM