- 7.1 Pagpipili ng Rebisyon
- 7.2 Staging na Interactive
- 7.3 Pag-stash at Paglilinis
- 7.4 Pag-sign sa Iyong Trabaho
- 7.5 Paghahanap
- 7.6 Pagsulat muli ng Kasaysayan
- 7.7 Ang Reset Demystified
- 7.8 Advanced na Pag-merge
- 7.9 Ang Rerere
- 7.10 Pagdebug gamit ang Git
- 7.11 Mga Submodule
- 7.12 Pagbibigkis
- 7.13 Pagpapalit
- 7.14 Kredensyal na ImbakanCredential Storage
- 7.15 Buod
- A3.1 Setup at Config
- A3.2 Pagkuha at Paglikha ng Mga Proyekto
- A3.3 Pangunahing Snapshotting
- A3.4 Branching at Merging
- A3.5 Pagbabahagi at Pagbabago ng mga Proyekto
- A3.6 Pagsisiyasat at Paghahambing
- A3.7 Debugging
- A3.8 Patching
- A3.9 Email
- A3.10 External Systems
- A3.11 Administration
- A3.12 Pagtutuberong mga Utos
A1.4 Appendix A: Git in Other Environments - Git in Bash
Git in Bash
If you’re a Bash user, you can tap into some of your shell’s features to make your experience with Git a lot friendlier. Git actually ships with plugins for several shells, but it’s not turned on by default.
First, you need to get a copy of the
contrib/completion/git-completion.bash file out of the Git source code.
Copy it somewhere handy, like your home directory, and add this to your
Once that’s done, change your directory to a Git repository, and type:
$ git chec<tab>
…and Bash will auto-complete to
This works with all of Git’s subcommands, command-line parameters, and remotes and ref names where appropriate.
It’s also useful to customize your prompt to show information about the current directory’s Git repository.
This can be as simple or complex as you want, but there are generally a few key pieces of information that most people want, like the current branch, and the status of the working directory.
To add these to your prompt, just copy the
contrib/completion/git-prompt.sh file from Git’s source repository to your home directory, add something like this to your
. ~/git-prompt.sh export GIT_PS1_SHOWDIRTYSTATE=1 export PS1='\w$(__git_ps1 " (%s)")\$ '
\w means print the current working directory, the
\$ prints the
$ part of the prompt, and
__git_ps1 " (%s)" calls the function provided by
git-prompt.sh with a formatting argument.
Now your bash prompt will look like this when you’re anywhere inside a Git-controlled project:
Both of these scripts come with helpful documentation; take a look at the contents of
git-prompt.sh for more information.