Git mergetool generates unwanted .orig files
2023-03-06
Question When I do a merge conflict resolution with Kdiff3 (and other merge tool I tried) I noticed that on resolution a *.orig file is created. Is there a way for it to not create that extra file? Answer A possible solution from git config: git config --global mergetool.keepBackup false After performing a merge, the original file with conflict markers can be saved as a file with a .orig extension. If this variable is set to false then this file is not preserved.…
Why are connections to GitHub over SSH throwing an error "Warning: Remote Host Identification Has Changed"?
2023-03-06
Question Just sometime ago I started getting this warning when pushing to GitHub. WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. Is this normal and how do I resolve it? Answer This happened because on the 24th of March 2023, GitHub updated their RSA SSH host key used to secure Git operations for GitHub.…
How to handle git gc fatal: bad object refs/remotes/origin/HEAD error?
2023-03-02
Question I randomly hit this today while trying to run Git garbage collect: $ git gc fatal: bad object refs/remotes/origin/HEAD error: failed to run repack How do I deal with this? Answer I don't understand the ramifications of this, but as suggested in this thread, when I encountered this I just did $ mv .git/refs/remotes/origin/HEAD /tmp (keeping it around just in case) and then $ git gc worked without complaining; I haven't run into any problems.…
How to list all tags along with the full message in git?
2023-03-01
Question I want git to list all tags along with the full annotation or commit message. Something like this is close: git tag -n5 This does exactly what I want except that it will only show up to the first 5 lines of the tag message. I guess I can just use a very large number. What is the highest number I can use here? Is it the same on every computer?…
Filename too long in Git for Windows
2023-02-28
Question I'm using Git-1.9.0-preview20140217 for Windows. As I know, this release should fix the issue with too long filenames. But not for me. Surely I'm doing something wrong: I did git config core.longpaths true and git add . and then git commit. Everything went well. But when I now do a git status, I get a list of files with Filename too long, for example: node_modules/grunt-contrib-imagemin/node_modules/pngquant-bin/node_modules/bin-wrapper/node_modules/download/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js: Filename too long It is quite simple to reproduce for me: just create a Yeoman web application with the Angular generator ("…
Git conflict markers [duplicate]
2023-02-28
Question This question already has answers here: </div> Git merge left HEAD marks in my files (6 answers) Closed 10 years ago. After I pulled from remote branch, I got conflict, when I open the file it looks something like below: <<<<<<< HEAD:file.txt Hello world ======= Goodbye >>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt I need some explanations of the markers, which portion of code is pulled from remote and which is from local? What does the code 77976da35a11db4580b80ae27e8d65caf5208086 stand for?…
Removing multiple files from a Git repo that have already been deleted from disk
2023-02-28
Question I have a Git repo that I have deleted four files from using rm (not git rm), and my Git status looks like this: # deleted: file1.txt # deleted: file2.txt # deleted: file3.txt # deleted: file4.txt How do I remove these files from Git without having to manually go through and add each file like this: git rm file1 file2 file3 file4 Ideally, I'm looking for something that works in the same way that git add .…