Tag: bash

How to remove path prefix when checking out remote branches with git bash?

This is a nice command to checkout all remote branches for remote in `git branch -r `; do git checkout -b $remote remotes/$remote; done If my structure is like this however: /refs |–remotes |–remote1/ |–branch1 |–branch2 |–remote2/ |–branch1 |–branch2 how can I let the above command execute only on remotes/remote1? Or put differently: If I […]

Authentication failed on tfs server

I am having a really weird issue with git bash on windows. When I am working in Visual Studio I have no problem working with my git repo stored in a tfs server. I just branched, committed and pushed. But when I try to do the same (fetch, pull, push…) in my git bash I […]

Unzip – how do I put inflated files into an array

I have an .xls file which I want to pretty print in order to have nice diffing rather than just binary files being changed. My approach is to unzip this entire thing. The resulting string does not contain linebreaks so I ran it through xmllint –format. But on this seemingly simple path I have encountered […]

Resource temporarily unavailable error when using git

I have an important issue: I work on a university Jira project on android since a few months and everything was working ok. Since 3 days and without reason my git stopped to work correctly (I’m on windows), indeed now I can’t do anything, android fail every VCS operation, from rebase, pull, to push.. I […]

Is there an easy way to delete untracked git files

This question already has an answer here: How to remove local (untracked) files from the current Git working tree? 28 answers

How to preserve colours rendered by git_ps1 with a multiline prompt?

I have the following .bash_profile #Change alias for ls to include colours alias ls=’ls -Gh’ #Enable git branch completion source ~/git-completion.bash #Allows git information to be visible in prompt source ~/git-prompt.sh GIT_PS1_SHOWDIRTYSTATE=1 GIT_PS1_SHOWCOLORHINTS=1 # ANSI colors: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html RED=”\[\033[0;31m\]” YELLOW=”\[\033[0;33m\]” GREEN=”\[\033[0;32m\]” CYAN=”\[\033[0;36m\]” LIGHT_GREY=”\[\033[0;37m\]” DARK_GREY=”\[\033[1;30m\]” NO_COLOUR=”\[\033[0m\]” ################################## #Configure multiline prompt # Prompt appearance should be: #[RED]user@host[\RED] [CYAN]working_directory[\CYAN] […]

Using Travis CI to build Jekyll site from master to gh-pages with deploy keys

I’m working on our site whose GitHub repo is here. It’s a no-plugin kind of site, but in order to schedule posts, I need a Cron running, and Travis-CI comes into picture here. My goal is to simply copy content from master and give it off to gh-pages. I’m using the deployment keys approach to […]

Check if a git repo exists in a shell script

Is there a way to check if a git repo exists using a bash or csh script? I know that we can use git ls-remote <repository> to check the existence of the remote repo. But I’d like to somehow do this programatically in a shell script.

Failed to pull from git automatically

I have a startup script that is supposed to sync the git repo on the machine with master git pull -r origin master Getting error: The following untracked working tree files would be overwritten by merge: file1.py Folder2/file3.rb Please move or remove them before you can merge. Aborting. tried solving this using git clean -df […]

Search for a branch name using wildcards

A git repo I am working with has over a hundred remote branches, if not hundreds of them. I’d like to be able to search for a particular branch whose name I know. Is it possible to search for a specific branch using its name? I also observe that many other branches have similar names […]

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