git-alias

Commands in a Git Script Functions (Windows) Not Working As Expected in Sub Folder Under a Git Repo

限于喜欢 提交于 2019-12-11 17:26:48
问题 I have the following folder structure... \GitRepo \.git [files] \IgnoredFolder #ignored from .gitignore \SubRepo I'm trying to right a script function in my .gitconfig file and I need to know the current directory , but I'm getting weird behavior. For all my tests, I've opened a Console2 window hosting Windows PowerShell to run my git commands. At the prompt if I type $pwd it 'correctly' displays C:\GitRepo\IgnoredFolder\SubRepo. I say 'correctly' but it is in Windows format instead of *Nix.

Git alias with two commands (stash pop + merge) executes only the first command. Why? How to execute also the merge?

那年仲夏 提交于 2019-12-10 03:05:55
问题 I set up a git alias like this: git config --global alias.popmerge '!git stash pop && git merge master' Then I call it, like this: git popmerge The " git stash pop " is executed, but the " git merge master " is ignored. If I run " git merge master " right after the " git popmerge "... it sumply runs as expected, performing the merge. I have other aliases with long sequences of commands... and they run flawlessly. It seems something at " git stash pop " makes the alias process to halt ... Is

How do I ask git to merge branch back to parent

£可爱£侵袭症+ 提交于 2019-12-07 23:48:12
问题 Is there a way to write an alias that merges a branch back to its parent? I know I can do: git checkout - && git merge - But it only works in simple cases when my previous branch is the parent branch. As far as I know git does not track this kind of information because there is no branches in there. But I hope it's already implemented as a plugin or a hookset. Thanks in advance. 回答1: Such an alias would involve first finding the "parent" branch. It isn't trivial, and the question "Find the

How do I ask git to merge branch back to parent

左心房为你撑大大i 提交于 2019-12-06 07:23:02
Is there a way to write an alias that merges a branch back to its parent? I know I can do: git checkout - && git merge - But it only works in simple cases when my previous branch is the parent branch. As far as I know git does not track this kind of information because there is no branches in there. But I hope it's already implemented as a plugin or a hookset. Thanks in advance. VonC Such an alias would involve first finding the "parent" branch. It isn't trivial, and the question " Find the parent branch of a branch " has some good solutions. Git’s history is based on a DAG of commits.

Git alias with two commands (stash pop + merge) executes only the first command. Why? How to execute also the merge?

喜欢而已 提交于 2019-12-05 04:40:25
I set up a git alias like this: git config --global alias.popmerge '!git stash pop && git merge master' Then I call it, like this: git popmerge The " git stash pop " is executed, but the " git merge master " is ignored. If I run " git merge master " right after the " git popmerge "... it sumply runs as expected, performing the merge. I have other aliases with long sequences of commands... and they run flawlessly. It seems something at " git stash pop " makes the alias process to halt ... Is it possible to avoid this behavior? How? Thanks. sehe Have you checked the exit code from stash pop? &&

What is the meaning of the “bang” or “!” before the git command?

孤者浪人 提交于 2019-12-04 23:39:20
As you can see from this excerpt, there is a "!" before the git command. What's the point? [alias] commitx = !git add . && git commit - https://stackoverflow.com/a/8956546/1354543 I understand aliases and what the command itself is doing, but not the point of the "!" before the git command. The ! means "run the following as commands to the shell", so in this case the alias git commitx expands to the equivalent of running git add . && git commit (which is a terrible terrible idea) An important aspect of ! not covered by the accepted answer is that for the shell command, the working directory is

Force push current branch

十年热恋 提交于 2019-12-04 14:59:09
问题 I often rebase feature branches and then want to force push them to the server. git push --force origin feature-mongodb-support Is there any shortcut for git push --force origin <current branch> ? 回答1: You can use aliases to shorten the command. Use it like this: git config --global alias.fpush "push --force origin" Now to push your branch just type: git fpush feature-mongodb-support Or you can even hardcode the branch name into the command: git alias fpush "push --force origin feature

Force push current branch

雨燕双飞 提交于 2019-12-03 10:21:12
I often rebase feature branches and then want to force push them to the server. git push --force origin feature-mongodb-support Is there any shortcut for git push --force origin <current branch> ? You can use aliases to shorten the command. Use it like this: git config --global alias.fpush "push --force origin" Now to push your branch just type: git fpush feature-mongodb-support Or you can even hardcode the branch name into the command: git alias fpush "push --force origin feature-mongodb-support" and use only git fpush to push your precious work into the upstream. However, non-fast-forward

How to alias 'git checkout' to 'git co'

孤街醉人 提交于 2019-12-03 00:12:39
问题 I'd like the command git co to be the same as typing git checkout . A normal Bash alias ( alias co='checkout' ) doesn't work. 回答1: The command: git config --global alias.co checkout will create a git alias to do that. It will add the following entry into your global ~/.gitconfig file: [alias] co = checkout 回答2: Also, can edit this into your git config: [alias] co = checkout 来源: https://stackoverflow.com/questions/14489109/how-to-alias-git-checkout-to-git-co

How to alias 'git checkout' to 'git co'

谁说我不能喝 提交于 2019-12-02 13:57:12
I'd like the command git co to be the same as typing git checkout . A normal Bash alias ( alias co='checkout' ) doesn't work. The command: git config --global alias.co checkout will create a git alias to do that. It will add the following entry into your global ~/.gitconfig file: [alias] co = checkout sma Also, can edit this into your git config: [alias] co = checkout 来源: https://stackoverflow.com/questions/14489109/how-to-alias-git-checkout-to-git-co