Tag: bash

How to change git from Chinese to English in mac

I remember I install git through port install git-core. And it show Chinese word as default like the followings: # 位于分支 master # 您的分支领先 ‘origin/master’ 共 2 个提交。 # nothing to commit, working directory clean and # 位于分支 master # 您的分支领先 ‘origin/master’ 共 2 个提交。 # # 尚未暂存以备提交的变更: # (使用 “git add <file>…” 更新要提交的内容) # […]

Checkout branch from Github without cloning whole repo, and without Git

I’m often building servers where the goal is to install some software that is stored in Github. The process goes: Install Git. Clone the Github repo. Checkout the right branch. Steps 1 and 2 can be pretty slow (a few minutes). Are there any tools that would allow me to cut to the chase, step […]

Git: Permission Denied when Opening Text Editor

I am trying to set the text editor that will open when Git needs me to type something (e.g., message for a commit). I am on Mac OSX 10.9.5 and using bash. I have configured the default editor to TextEdit – my .gitconfig file looks like this: [user] name = My Name email = MyEmail@host.com […]

Getting git return values in shell script

I’m writing a shell script that makes some git calls. In particular, I’m looking for a way to figure out if a git rebase call is successful or if there is a merge conflict. This is what I have so far. returnStatus=$(git rebase master); if [[ returnStatus == 1 ]]; then break; else echo $branch; […]

How to hard reset from one git branch to other in JGit?

I have two branches one is master and another one level1. Now level1 is the latest I need to hard reset master to level1 normally in git bash I can do that by following command. $ git checkout master $ git tag old-master-branch $ git reset –hard level1 $ git merge -s ours origin/master $ […]

set umask on remote server through fabric script

Me along with a team of developers use fabric to deploy code to remote server, Whenever a new file is created and added to the git repo the default permission will be -rw–r–r which makes it impossible for other developers to update this file (all users belong to same primary group). I want the permissions […]

bash show git branch as dirty all the time

I am using a bash script that I found online somewhere, and it is everywhere, to display current git branch. function parse_git_dirty { [[ $(git status 2> /dev/null | tail -n1) != “nothing to commit (working directory clean)” ]] && echo “*” } function parse_git_branch { git branch –no-color 2> /dev/null | sed -e ‘/^[^*]/d’ […]

GitHub – Pushed a change to master, but appears as different user than me?

I have a GitHub repo located here. I just commited a change to my repo and pushed to master branch, as I always do. I entered my account name and password, and the commit was pushed to GitHub. However, when I checked my GitHub commits page, I see a user that is not me. Did […]

How do I exclude files from git ls-files?

How do I list everything except markdown files? I have tried, as show in the code below, to run ls-files with the –exclude flag, but the excluded files are still shown in the output. My git version is 2.6.4 (Apple Git-63) $ git ls-files ChromeExt/read-coffee Node/README.md Node/web-scraping README.md $ git ls-files –exclude *.md ChromeExt/read-coffee Node/README.md […]

combine two bash commands into a one shortcut prompt

I’m not great with bash, but i’d like to write a shortcut, such as ‘opendev’, that opens a url in a browser and opens the current git topic branch i’m on. (only needs to work on os x). Inspiration here is from heroku CTL’s “heroku open”. I’ve got the basics here but i’m not sure […]

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