[Git Note] tips: how to configure command auto-completion and command alias

Source: Internet
Author: User
Tags aliases git commands

1. Auto-Completion
After installing git on a linux machine, commands cannot be automatically completed by default. For bash users, implementing git command completion is very simple:
1) download git source code, cd to the contrib/completion directory, find the git-completion.bash File
2) copy the above files to the home Directory of a person, which can be set to a hidden file to avoid accidental deletion:
Cp./git-completion.bash ~ /. Git-completion.bash
After completing the preceding two steps, when you enter the git command, you can press the tab key twice to automatically complete the command.

2. Git Aliases
Setting aliases for common git commands saves the trouble of inputting long-string commands each time. In git, you can use the git config command to conveniently set alias. For example:
Shell> git config -- global alias. co checkout
Shell> git config -- global alias.br branch
Shell> git config -- global alias. ci commit
Shell> git config -- global alias. st status
Shell> git config -- global alias. last 'Log-l head'
After running the preceding command, you can ~ /. In the gitconfig file, these aliases are listed in the alias configuration item.
In fact, we can also directly edit ~ /. Gitconfig file to set the alias ^_^

[References]
ProGit-Chapter 2: Git Basic

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.