Tag: bash

Git hook not running 2 consecutive commands

I’m trying to create a pre-push hook to run php-cs-fixer before every push. This is the current pre-push hook I have: #!/bin/sh exec php-cs-fixer fix . –config-file=”.php_cs” && git commit -am ‘PSR-2’ The first command gets trigger without a problem. Only the git commit -am ‘PSR-2 doesn’t. To be more precise, the php-cs-fixer runs followed […]

What's the easiest way to use the output paths from a git command in a subsequent git command?

I far too frequently use the mouse to do things like this: /home/me-$ git log –name-status -1 commit a10e63af1f4b1b2c28055fed55d4f2bb3225a541 Author: Me <me@me.com> Date: Tue Aug 18 13:04:04 2015 -0400 XYZ-376 make ctors public M x/y/z/Class1.java M x/y/z/Class2.java /home/me-$ git checkout — x/y/z/Class2.java # <– copy/paste with the mouse I know that some git commands accept […]

How do I add autocomplete to git aliases?

I have setup git autocomplete using the git-autocomplete.bash file which works for standard commands and simple aliases (co = checkout), but I have a longer alias defined in my .git-config file that I would like to autocomplete branch names on and I cannot find how to do this. I am on Windows Server 2012 R2 […]

Git bash giving error of warning: unable to rmdir

I am using git bash on windows 10 which was recently updated to creators update. whenever i am trying to switch between branches i get following thing $ git fetch && git checkout master warning: unable to rmdir Ionic_Developemnt: Directory not empty Checking out files: 100% (6312/6312), done. Switched to branch ‘master’ Your branch is […]

Why PS1 is not updated with the git branch name?

PS1=”\\w (`git branch | grep ‘^*’ | cut -b 3-100`)$ ” I set my PS1 as above, but it will not update the branch name in the prompt after I change the branch with git checkout, or change the repository with the cd. How to fix this?

Using git as a deployment tool

I am trying to use git as a deployment tool, so when there has been a push to the production branch I want to update the remote server accordingly. However, when I run the second command(the pull) it comes back with a error that says Operation must be run in a work tree. Can anyone […]

What's wrong with logging into peer network -hyperledger fabric (eca.user)?

can anyone help me out with this? I’m not sure what’s wrong with the login of the peer network(hyperledger fabric). I followed their steps in http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup/ , under the note on security functionality. I tried as what’s stated. I did vagrant ssh, cd $GOPATH/src/github.com/hyperledger/fabric/peer and followed by peer network login admin (a default file of […]

Forward exit code in bash if

I want to run a command on bash that shows the output of git status, but only if something interesting is there. In other words: If everything is fine, I don’t want the command to print anything. Basically I can achieve this by running: if [[ $(git status -s) ]]; then git status; fi The […]

What does the argument “–add” mean in the “git config” command?

I’ve stumbled across a git command: git config –global –add merge.ff false Presumably it disables fast-forwarding by default when merging branches. But the –add option caught my eyes, so I’m now wondering what does it do exactly. Anyone?

Why I lost my master branch after executing `git checkout -b 3_1 `?

I’m using Git Bash 2.9.0-64-bit in win7 64bit. I created a git repository called lec_yaac. This is the related information about branch master: wen@wen-PC MINGW64 /d/Git/lec_yaac (master) After I executed command git checkout -b 3_1,it changed to wen@wen-PC MINGW64 /d/Git/lec_yaac (3_1) And I added and commmited some files. But when I executed git branch,it only […]

Git Baby is a git and github fan, let's start git clone.