Git does not have a way to backup a working copy. (You can use git commit, but that pollutes your repo with backups.) So I use git diff, but it has an issue with Visual Studio 2010 (VS). Sometimes, VS saves C# files as UTF-8, sometimes UTF-16LE. When VS switches a file from one to the other, the git patch file says, "Binary files a/path1/file1.cs and b/path1/file1.cs differ," and git apply cannot restore from the patch file. What's the easiest solution?
我在https://github.com/user7251/repo1/tree/master/BackupGitWorkingCopy 上开发了一个解决方案 BackupGitWorkingCopy
如果您只想在 repo 之外的某处备份已更改/新/未跟踪的文件,您可以使用:
git status -s | awk '{print $2}' | xargs tar -czf /root/git_backup.tar.gz
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.