git-config

how to understand remote “origin” fetch setting in .git/conf file?

爱⌒轻易说出口 提交于 2019-12-21 21:38:30
问题 I saw the command in .git/config when I learn pull & request from this article. fetch = +refs/pull/*/head:refs/pull/origin/* I open my config file which is different as this fetch = +refs/heads/*:refs/remotes/origin/* . After I modify fetch setting line as the article read and run those git commands: git fetch origin git checkout -b 1 pull/origin/1 The config file automatic append this: [branch "1"] remote = origin merge = refs/pull/1/head Could someone can explain the means and difference

Prevent git from automatically generating user email if missing

我是研究僧i 提交于 2019-12-21 12:39:11
问题 Is there a way to globally configure git to not automatically generate user's email, if none is set and abort the commit instead? $ git commit -m "test" [master (root-commit) 71c3e2e] test Committer: unknown <my.user@my.very.own.hostname> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. This can cause serious privacy leaks if the committer is not careful enough to check git warnings. 回答1: Set git config -

`git add --patch` with `--word-diff`

让人想犯罪 __ 提交于 2019-12-21 07:58:06
问题 git add --patch provides a great interface for reviewing unstaged changes and then staging only the ones that are wanted in the next commit. Great, except for one thing: there is no obvious way to choose which diff view to use. In particular, I would like to be able to configure git add --patch to present diffs to me the same way that git diff --word-diff does. How can I achieve that? (N.B. neither --word-diff nor --word-diff --color is exactly the same as --color-words , and so this question

Setting diffmerge as visual Git difftool not working

孤街浪徒 提交于 2019-12-21 05:43:09
问题 I am trying to configure DiffMerge as my difftool in Git but having no luck. This is the revelent section of my .gitconfig file (the other settings not shown are just for the user). [diff] tool = diffmerge [difftool "diffmerge"] cmd = \"C:\\Program Files\\SourceGear\\Common\\DiffMerge\\sgdm.exe\" \"$LOCAL\" \"$REMOTE\" Whenever I call git difftool from the powershell command line the conflicts are shown directly beneath in the powershell interface, not in diffmerge as intended. I know the

Git config with directory scope, containing multiple repositories

半城伤御伤魂 提交于 2019-12-20 12:29:28
问题 The situation is as follows: I have multiple domains in which I write code, e.g. professional and free time. Those are represented by different directories on my computer. Each of those domains contains multiple Git repositories, in a hierarchical directory structure inside one of the domain directories. Per domain, I want to use a different email address as part of author/committer information. That is, I want my private address to be listed in my free-time projects and my company address in

git: fatal unable to auto-detect email address

[亡魂溺海] 提交于 2019-12-20 09:25:48
问题 I just cannot commit with git on Ubuntu 14.04 Error message is git: fatal unable to auto-detect email address (got "some wrong email") I tried git-config with and without the --global option setting user.name and user.mail but nothing works 回答1: Probably a typo mistake: set user.mail with no e . Fix it by setting user.email in the Global Configuration with $ git config --global user.email "you@example.com" Already been asked: Why Git is not allowing me to commit even after configuration? To

What is $(prefix) on $(prefix)/etc/gitconfig?

非 Y 不嫁゛ 提交于 2019-12-19 13:48:45
问题 gitconfig(1): If not set explicitly with --file, there are four files where git config will search for configuration options: ... $(prefix) /etc/gitconfig System-wide configuration file. What is $(prefix) on $(prefix)/etc/gitconfig ? 回答1: The prefix environment variable git was compiled with. Usually, it's empty, so the path is /etc/gitconfig . 来源: https://stackoverflow.com/questions/19713622/what-is-prefix-on-prefix-etc-gitconfig

Git listing non-existent remotes

别等时光非礼了梦想. 提交于 2019-12-19 07:04:11
问题 I recently made some changes to my remote repos in my Git repo config file. I renamed the remote names, changing my origin to another remote repo and renaming my old origin. For example, I had this previously: [remote "origin"] url = blah blah [remote "future"] url = blah blah I went in and changed them so they look like this: # formerly the origin [remote "old-origin"] # formerly the future repo [remote "origin'] But now, when I type git branch -a , I am seeing branches listed from the old

How to make git ignore changes to submodules by default

你。 提交于 2019-12-19 03:19:14
问题 Since gitmodules were introduced in Git, I like to add them like so: [submodule "actionbarsherlock"] path = actionbarsherlock url = git://github.com/JakeWharton/ActionBarSherlock.git ignore = dirty The important part here is ignore = dirty . When using the git submodule add command, I'm forced to add this line by myself in the .gitmodules file. How can I make this the default behavior for every git submodule add I'll make in the futur? I know about the submodule.<name>.ignore configuration,

Delete username from a Git repository

冷暖自知 提交于 2019-12-18 14:05:32
问题 I am getting this warning when I try to set my user name in Tower: warning: user.name has multiple values I have checked in a terminal window and found that I have three usernames: macmini:HiBye shannoga$ git config --get-all user.name Shani shani shani How can I delete two of the user names? 回答1: Use git config -e and you should see something like: [user] name = Shani name = shani name = shani Delete the lines you don't want. 回答2: This worked for me on my Mac: git config --global --unset-all