Quick Tip: Autocomplete Git Commands and Branch Names in Bash

 | COMMENTS

In bash in Mac OS X, you can use [TAB] to autocomplete file paths. Wouldn’t if be nice if you could do the same with git commands and branch names?

You can. Here’s how.

First get the git-completion.bash script (view it here) and put it in your home directory:

1
curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

Next, add the following lines to your .bash_profile. This tells bash to execute the git autocomplete script if it exists.

1
2
3
if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

Now open a new shell, cd into a git repo, and start typing a git command. You should find that [TAB] now autocompletes git commands and git branch names.

For example, if you type git then add a space and hit [TAB], you’ll get a readout like this, which lists all available git commands:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
add                 filter-branch       reflog
am                  format-patch        relink
annotate            fsck                remote
apply               gc                  repack
archive             get-tar-commit-id   replace
bisect              grep                request-pull
blame               gui                 reset
branch              help                revert
bundle              imap-send           rm
checkout            init                send-email
cherry              instaweb            shortlog
cherry-pick         log                 show
citool              merge               show-branch
clean               mergetool           stage
clone               mv                  stash
commit              name-rev            status
config              notes               submodule
describe            p4                  svn
diff                pull                tag
difftool            push                whatchanged
fetch               rebase

Now to learn what some of these more exotic git commands do! What’s your favorite git command?

(I learned this way of installing git-completion.bash here.)

http://code-worrier.com/blog/autocomplete-git/

너무 편해 졌다. 


'PMS' 카테고리의 다른 글

Mantis 상태추가  (0) 2011.10.09
이슈 트래커 비교  (0) 2011.09.05
Mantis 환경 설정의 비밀  (0) 2011.09.05
Mantis GD error 25128 에러가 날 때 해결 책  (0) 2011.07.29
Mantis 날짜 Custom field  (0) 2011.07.26

설정

트랙백

댓글

Objective-C의 Dot syntax

맥북 2013. 5. 31. 18:30
Objective-C의 Dot Syntax
점 구문이 Objective-C 2.0에 도입되면서 많은 논란이 되어 왔다. 예전 부터 코코아 프로그래밍을 해왔던 개발자들은 주로 반대의 입장을 피력했고 또한 그와는 반대의 주장을 하기도 한다. 

여기서는 그런 논란은 생각하지 말자. 다음 두 구문은 완전하게 동일하다.

self.timestamp = [NSDate date];

[self setTimestamp:[NSDate date]];


점 구문은 전통적인 메시지 전달 방식을 간단히 표현하게 해준다. 언제든 점 구문을 전통적인 메시지 전달 방식으로 변경할 수 있다. 그러나 다음의 구문이 다르다는 것을 이해하는 것은 매우 중요하다.


'맥북' 카테고리의 다른 글

(맥북) WinSCP  (0) 2013.05.31
맥북 프로그램 강제종료  (0) 2013.04.01

설정

트랙백

댓글