Git command notes

Source: Internet
Author: User

Git common command notes git undo add operation before submission problem: when using git, before not added. use git add before the ignore file. add all files to the database, and accidentally add some files that do not need to be added to the version database. The HEAD version does not exist because it has not been submitted yet. You cannot use the git reset HEAD command. Solution: Use git rm-r -- cached. ps: note that the last step is a bit. Commit rewrite the last commit git commit-m' rewrite the last commit 'git add forgotten_file // add the file git commit -- amend ---------------------------------------------- remote commit git remote add [shortname] [url] // Add remote repository git remote-v // list remote repository git remote show [remote-name] // list remote repository details git remote rename old-name new-name // Rename the remote repository git remote rm [remote-name] // Delete the remote repository ---------------------------------------- fetch pull git fetch [remote-name] // pull the remote data to the local repository, it is not automatically merged to the current branch and still needs to be manually merged. Using tag pull git tag v1 // create tag git tag-a v1-m' create tag 'git show v1 // view tag version information ------------------------------------ automatic complementing function in linux -------------------------------------- in git Source git-completion in the contrib/completion directory. copy bash to your user directory. And add the following content to your. bashrc file source ~ /. Git-completion.bash --------------------------------- set Git command alias ------------------------------------------------- git config -- global alias. co checkout // set the checkout command alias git config -- global alias.br branch // set the branch command alias git config -- global alias. ci commit // set the commit command alias git config -- global alias. st status // set the status Command alias git config -- global alias. last 'Log-1 head' // view the last commit information git config -- global Lias. visual "! Gitk "// start gitk. To run an external command, you only need to add it before the command!.

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.