git-config

Can gitconfig options be set conditionally?

丶灬走出姿态 提交于 2019-11-30 06:55:37
问题 Via Github I use the same set of "dot files" on several different computers and servers. On the Macs and Linux boxes under my direct control I have Sublime Text 2 installed and set up as my git merge and commit editor of choice. However, on remote (i.e., not under my direct control) servers I would select to use vim. I would rather not create and maintain a second .gitconfig for those remote servers. Is there a way to do something like this: [core] if [[ $IS_REMOTE -eq 1 ]]; then editor =

Git create remote repository on push

戏子无情 提交于 2019-11-30 02:59:01
I have been trying to figure this one out but I am having a hard time doing so. I am currently working on an open source project that requires me to allow a user to push to remote repository without it already existing there. I want to avoid manually logging in to a server and running git init or git init --bare . For obvious reasons, I get the following error when trying to push my local repository to a path that doesn't point to an existing repository on the remote server: fatal: '/var/repositories/myrepo' does not appear to be a git repository fatal: The remote end hung up unexpectedly But

How to emulate git log --decorate's different colors per branch-type

萝らか妹 提交于 2019-11-29 19:56:31
In making my favorite git log view I've created this alias: graph = log --pretty=format:'%Cgreen%ad%Creset %C(yellow)%h%Creset%C(yellow)%d%Creset %s %C(cyan)[%an]%Creset %Cgreen(%ar)%Creset' --date=short --graph This creates an output like: What I'm missing here is the different coloring of branch types like in log --oneline --decorate --graph . The --decorate (which uses =short by default) gives the different recognized branches a different color. The branch types (HEAD, origin/master, origin/HEAD, master) are colored cyan, red, red, green. Mine however are uncolored; colored only with the

How to colorize git-status output?

拥有回忆 提交于 2019-11-29 19:04:25
I want to colorize git-status output so that: untracked files = magenta new files = green modified files = blue deleted files = red I am instead seeing staged files in green and unstaged files in blue: My .gitconfig is setup with the following based on some searching: [color] status = auto [color "status"] added = green changed = blue untracked = magenta deleted = red VonC From git config doc : color.status.<slot> Use customized color for status colorization. <slot> is one of: header (the header text of the status message), added or updated (files which are added but not committed), changed

What's the difference between `git config` and `git push --set-upstream`

北城余情 提交于 2019-11-29 12:13:13
Question What's the difference between: $ git remote add origin git@github.com:yourname/yourproject.git $ git config remote.origin.push refs/heads/master:refs/heads/master $ git push and: $ git remote add origin git@github.com:yourname/yourproject.git $ git push origin master -u Is the second version simply newer and shorter than the first version, or are there other differences? Background Research As of Git 1.7.0, you can use the --set-upstream option with git push . According to the git push manual: -u, --set-upstream For every branch that is up to date or successfully pushed, add upstream

Add a git merge driver to the repository?

北慕城南 提交于 2019-11-29 03:23:40
I'm creating a merge driver. I have defined a .gitattributes file as follows: filename merge=mergeStrategy I have created the merge driver in $PROJECT/.git/config as follows: [merge "mergeStrategy"] name = My merge strategy driver = scripts/mergeScript.sh This works fine locally, but I would like to commit this merge driver to the git repository so that the merge strategy is in effect for everyone. Is there a way I can add this (or other Git configuration options) to the repository itself? VonC You could simply add and commit (and push) script/mergeScript (along with the .gitattributes file,

Can gitconfig options be set conditionally?

☆樱花仙子☆ 提交于 2019-11-29 01:23:42
Via Github I use the same set of "dot files" on several different computers and servers. On the Macs and Linux boxes under my direct control I have Sublime Text 2 installed and set up as my git merge and commit editor of choice. However, on remote (i.e., not under my direct control) servers I would select to use vim. I would rather not create and maintain a second .gitconfig for those remote servers. Is there a way to do something like this: [core] if [[ $IS_REMOTE -eq 1 ]]; then editor = "vim" else editor = "subl -n -w" fi where I've somehow set $IS_REMOTE based on the hostname? No, Git

Git create remote repository on push

醉酒当歌 提交于 2019-11-29 00:39:36
问题 I have been trying to figure this one out but I am having a hard time doing so. I am currently working on an open source project that requires me to allow a user to push to remote repository without it already existing there. I want to avoid manually logging in to a server and running git init or git init --bare . For obvious reasons, I get the following error when trying to push my local repository to a path that doesn't point to an existing repository on the remote server: fatal: '/var

Always use the pager for git diff

喜你入骨 提交于 2019-11-28 20:54:32
问题 I'm using less as my git pager. If the git diff output is readable on one page, my git prints the output to the screen. Sometimes I'm too fast with typing Ctrl+D (half page down), which kills my terminal. Is there an option to enable the pager for git diff , even if the output is very small? Doesn't work: git -p diff git --paginate diff git settings: pager.diff = true 回答1: This is controlled by the -F ( --quit-if-one-screen ) option to less. Git uses the options FRSX for/of less by default,

Configure a local branch for push to specific branch

*爱你&永不变心* 提交于 2019-11-28 18:52:39
Sorry if this question has been asked already. Am cloning from a repo named "git_lab" which has a branch named "test" When cloning i use "-b myname_test" to create a local branch named "myname_test" and local clone is named "myname_git_lab" When i do "git pull" it automatically fetches and merges changes from "test" to "myname_test", but for git push, i need to specify the repo and branch name. $>git remote show git_lab Local branch configured for 'git pull': myname_test merges with remote test Is there a way where i can configure "local branch configured for 'git push'" so that i dont need to