Tag: bash

Git: Working with executables

I have a project in which there is a .sh file and it has to be in the executable mode once pulled by the others. Now, I already changed its permissions on my local machine. However I want it to be pushed/pulled as executable as well, so that the other users do not have to […]

git clone fatal: cannot create work tree dir permission denied

so I’m trying to clone a repository from git, into a folder i know I have write access in. I’m trying to clone it using IntelliJ’s built in VCS capabilities, and the git bash program from git-scm.com Both of them return the following error: fatal: could not create work tree dir ‘<repo name>’ : Permission […]

bash: optimizing a git-aware shell prompt

I’ve written the following PS1, which will append the current working branch to the shell prompt if I am in a git repo, and do nothing otherwise: PS1=’\[\e[00;32m\]\u@\h\[\e[0m\]\[\e[00;33m\] [\w]$(branch=`git symbolic-ref –short -q HEAD 2> /dev/null || git rev-parse -q –short HEAD 2> /dev/null` ; if [ $branch ] ; then echo -n -e ” \e[95m<$branch>” […]

How should I edit a patch checkout when removing lines?

I have a file bar.txt in which I removed 3 lines and did not stage anything yet. I want to restore one of the removed lines via git checkout -p. Example/Bash output: $ git checkout -p foo/bar.txt diff –git a/bin/custom/foo/bar.txt b/bin/custom/foo/bar.txt index 35483b7..e945cae 100644 — a/bin/custom/foo/bar.txt +++ b/bin/custom/foo/bar.txt @@ -1097,9 +1097,6 @@ mond.desc.refinements = Foo […]

git fails to clone: The remote end hung up unexpectedly

I’m using bitbucket for my team project. The problem only appeared after I deleted the local repository (because it wouldn’t let me commit changes, but that’s another story). But when i cloned for the first time, it did work (I used the HTTP URL). Currently, when I try to clone using the Visual Studio’s team […]

Conditional space in PS1

I’m basically trying to create a PS1 that has this output: $ ~/Projects/Blah (master): However, if the folder I’m in is not a Git repository, I want it to look like this instead: $ ~/Projects/Blah: This is my current PS1: export PS1=”$ \w \$(__git_ps1): ” It gives me the output I want for when I’m […]

Get output of FOR with EOF in bash

I’ve created a bash script to temporarily help me send some files to a FTP server based on the id of the commit, i get the last commit, track the files and send as listed below. #!/bin/bash commit_hash=$(git log –format=”%H” -n 1) [[ -z “$1” ]] || commit_hash=$1 files=$(git diff-tree –no-commit-id –name-only -r $commit_hash) echo […]

How could I parse an output command with shell scripting?

I’m working on a shell script that is an interface for Git using Whiptail (shell interface). There is my problem, I would like to create a menu where we could select the branch of a Git repository and return this string to the script. I know how to get the different names of Git branches […]

How do I restart a python script running inside of a screen using a bash script?

Okay here’s my situation: On a server I have a screen session (which was initiated using screen -S python-script) running a python script inside of it. I make changes to this project by pushing to a git repo. When I want to have the changes reflected on the project, I ssh into the server, screen […]

Tutorial on git using git bash fixing the conflict

I’ve following a tutorial on git using git bash and came to the point where after typing the git command git commit below show up. I’m in windows operating system and I can no longer proceed. Merge branch ‘second-branch’ # Conflicts: # index.txt # # It looks like you may be committing a merge. # […]

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