when I settings use libgit2. but it always remind me to set git.exe path.
I want to use libgit2 to replace git.exe for data upload, can I do this?
TortoiseGit requires a git.exe in any case, because not all functonality is provided by libgit2 or implemented.
If you want to use the experimental libgit2 functions, you have to adjust a DWORD value in registry (HKCU\Software\TortoiseGit\UseLibgit2_mask). Setting it do DWORD_MAX (0xffffff) it will enable all implemented libgit2 functions in TortoiseGit.
Related
I installed git 2.28.0 on windows.
In fact, i can't find post-checkout.sample hook in the hooks repository under /.git repository.
Is post-checkout.sample hook supported on windows ?
When i installed the same version of git on linux i found the post-checkout.sample hook.
I even tried with the git 2.23.0 version and i had the same problem.
I tried to create post-checkout that print a simple message "hello". But it doesn't work. However when I copied this file in pre-commit it works.
Any suggestions?
It seems that it doesn't work on an empty repository.
I just committed a file in my repository and when i excute git checkout -b new_branch, the post-checkout hook worked.
I never saw a post-checkout.sample in mingw64/share/git-core/templates/hooks/ of a Git For Windows distribution.
But that hook should work, provided you make it:
a file named "post-checkout"
a bash script (see an example here)
in your repo/.git/hooks folder
There was actually a proposal (RFC) for a post-checkout.sample in 2009, but it was not picked up at the time.
The question was asked (also in 2009):
I also noticed that the
post-checkout sample does not exist when I init a new archive. Is this a
bug?
No, it's security.
Hooks are executable files and shouldn't blindly be
copied around for security reasons.
I have had git LFS enabled on my repository for a while and it has always worked perfectly. Recently, I have been having issues where my local files are being replaced with links.
As an example, I have a png file that will no longer open because the file format is not supported. Upon opening the file in notepad, I am presented with this.
version https://git-lfs.github.com/spec/v1
oid sha256:733c51c9ee6f0f395f5f042869307154d6ebf6d5d5e3bc10e2af68a432903bf0
size 5104
Many of my files are being replaced with these links and my programs that are accessing these files are throwing errors as they are unable to read them.
I am working in Windows 10, I have git lfs installed, I am using git-bash on the Windows Cmd line. I believe that when I was installing git-bash, I enabled symbolic links, I am unsure if that could potentially be causing the issue.
If you need more information, please let me know. I really appreciate everyone's help!
These are the pointer files that Git LFS uses to track objects. The fact that you're seeing them means that the proper filters for your repository aren't set up. Run git lfs install within your checkout to install the filters both in your repository and in your ~/.gitconfig.
Once you've done that, you can run git lfs checkout to fix the current repository, and then Git LFS should work normally when you check out a branch. If you modify or replace your ~/.gitconfig file, be sure to keep the filter entries that git lfs install inserted there.
The proper commands to set the options are as follows:
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"
It's much easier to invoke git lfs install, though.
With new versions of git new commands have been added which I will probably never use.
Is there a way I can disable these commands so that I my tab completion is faster?
For ex: before, git check<tab> would autocomplete to git checkout
But now git check<tab> doesn't tab complete due to there being git check-mailmap in the newer git version.
This is just one of the example.
Alternatively it would be great if I could "force" git to tab-complete "check" to checkout .
Edit: I use vanilla bash with no extra modifications
The official way is to use the configuration completion.commands and remove the ones you don't want:
git config --global completion.commands -check-mailmap
However, you can do even more. There is a hack in __git_main() used for testing that you can abuse to do what you want:
GIT_TESTING_PORCELAIN_COMMAND_LIST="$(git --list-cmds=list-mainporcelain,alias)"
This will force Git's completion to show only the main commands (and aliases).
You need Git v2.18 or newer for these to work.
To see how to remove items from the autocomplete, see FelipeC's answer.
An alternative is to use git aliases to create shorter alternatives to the commands you commonly use. For example:
git config --global alias.co checkout
Now you can type git co to check out files.
I installed a git precommit hook and sometimes I want to commit with --no-verify flag. I know how to do that in command line but I'd like to do that in TortoiseGit (since command line is very poor in Windows). How can I do that? I read through https://tortoisegit.org/docs/tortoisegit/tgit-dug-commit.html but can't find anything helpful.
No, it's not possible right now (as of 2.13.0.0) - it's not documented explicitly, just deducible using the source code.
If you use TortoiseGit, you should consider to use TortoiseGit hooks instead of vanilla git hooks.
Given a (source) patch file, what's the easiest way to apply this patch on the source files under Windows?
A GUI tool where I can visually compare the unchanged-changed source lines would be great.
A good way to apply a patch file under Windows OS is using Git.
As I understood, Git is a version control solution like SVN.
Here is a guideline to apply a patch :
First of all, download the latest release of the Windows Git Edition here :
GIT
With the cmd prompt, change directory to the patch file and files to patch
Now you can use the following command line :
git apply --ignore-space-change --ignore-whitespace --whitespace=nowarn file.patch
Not that since Git 2.3.3 (March 2015), you can use git apply --unsafe-paths to use git apply outside a git repo.
See commit 5244a31 by Junio C Hamano (gitster)
"git apply" was not very careful about reading from, removing, updating and creating paths outside the working tree (under --index/--cached) or the current directory (when used as a replacement for GNU patch).
The documentation now includes:
--unsafe-paths:
By default, a patch that affects outside the working area (either a Git controlled working tree, or the current working directory when "git apply" is used as a replacement of GNU patch) is rejected as a mistake (or a mischief).
When git apply is used as a "better GNU patch", the user can pass the --unsafe-paths option to override this safety check.
This option has no effect when --index or --cached is in use.
So if you have git installed, git apply could help, even outside of any git repo.
Patch for Windows is what you're looking for.
WinMerge is awesome.
http://winmerge.org/