Tag: bash

Unable to use bash script to remove files from git history

I have a problem with this bash script I am writing. I am trying to apply step 3 of this procedure from Github documentation to remove all files in our repositories history from our git history. For example, if .gitignore ignores .txt, I want to remove all .txt from the history. And so on for […]

Determine relationship between commits

In a linear history, two commits A and B can have one of three states: A and B are the same commit A strictly before B B strictly before A Git’s nonlinear history allows for four additional options A and B share both a parent and child A and B share a parent but not […]

“${1-}” vs “$1”

The code for git bash completion, specifically the function __gitcomp, uses parameter expansions like “${1-}”. This appears to be similar to “$1”. What is the difference? Also: where is this documented in the bash manual?

How to check if Git is installed from .bashrc

I’m using Git, I’ve changed the following line in .bashrc, To show the current checkedout branch in prompt, when pwd is a Git Repo. Operating System I’m using is: Ubuntu 32bit # Original PS1 Line PS1=’${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ‘ I’m using this line to display current branch of git repo in shell prompt, instead of, the above […]

What are the commands for using Git Bash in Windows e.g. when in git diff mode?

In Windows, in Git Bash, if I do a git diff I get all the differences flushed to the console with some sort of prompt to control the output buffer. What are the commands I can use in this mode of Git Bash? I don’t know where to look for a quick reference. I’ve worked […]

How to write a shell script that checks if git repository is up to date?

#!/bin/bash #gedit tidy plugin init=false SRC_DIR=~/repos DIRECTORY=”Gedit-Clientside-Plugin” #making repos directory if [ ! -d “$SRC_DIR” ]; then mkdir $SRC_DIR; fi if [ ! -d “$SRC_DIR/$DIRECTORY” ]; then init=true cd $SRC_DIR && pwd && git clone git://github.com/trentrichardson/Gedit-Clientside-Plugin.git && cd $DIRECTORY else cd $SRC_DIR/$DIRECTORY fi #below here is what I’m having trouble with git pull 1>&1 | […]

Adding git alias to .bash_profile not working

I edited my $Home .bash_profile to include some git alias commands. I am rather new to this and I can’t figure out what went wrong. .bash_profile alias gs=’git status ‘ alias ga=’git add ‘ alias gb=’git branch ‘ alias gc=’git commit’ alias gd=’git diff’ alias go=’git checkout ‘ alias gk=’gitk –all&’ alias gx=’gitx –all’ alias […]

Git – How to find all “unpushed” commits for all projects in a directory?

I’m finally getting used to Git and, after the initial steep learning curve, I must say it’s quite good (I just miss the single file externals, but that’s another story). I have, however, an issue that I can’t solve: I’m currently working on a dozen projects at the same time. They are all interconnected and […]

git bash fail to push branch with error message: “object directory does not exist”

recently I’ve updated my Git Bash to the latest version and now when I’m trying to push a branch to the remote server I get an error message: $ git push –set-upstream origin bugs/purlin_support_reactions Counting objects: 41, done. Delta compression using up to 4 threads. Compressing objects: 100% (41/41), done. Writing objects: 100% (41/41), 4.91 […]

Git Bash: Launch Application via Alias without hanging Bash (WIndows)

I’ve created several bash aliases in Git Bash on Windows, to launch executables from the bash shell. The problem I am having is that is seems the bash is waiting for an exit code before it starts responding to input again, as once I close the app it launched, it starts taking commands again. Is […]

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