Git commands
1. The commonly used
Git remote add origin [email protected]: yeszao/dofiler git # configure the remote git repository git pull origin master # download code and fast merge git push origin Git branch # checkout git branch # checkout git branch -b dev Git config --global core.editor vim Git config --global user. Name "YOUR name "# git config --global user Git config --global user.email "YOUR email ADDRESSCopy the code
2. Alias alias
Git config --global alias.co="checkout" git config --global Git config --global alias.cm="commit "# Commit git config --global alias.st="status" # Git config --global alias.pushm="push origin master" # git config --global alias.push origin master # Git config --global alias.log="git log --oneline --graph --decorate --color=always --global alias.logg="git log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white) -- %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relativeCopy the code
3. Create a version library
Git clone <urlCopy the code
4. Modify and submit
Git add. Git add <file> # git mv <old> <new Git commit -m "commit message" # Commit all the updated files git commit --amend # Modify last commitCopy the code
5. View history
Git log -p <file> # check the git commit history of the specified fileCopy the code
6. Cancel
Git reset --hard <version> # Git checkout HEAD <file> # Git checkout -- <file> # git revert <commit> # Undo the specified commit branchCopy the code
7. Branches and tags
Git branch -d <branch> # Git tag -a "v1.0" -m" Git tag -d <tagname> # git checkout dev # git cherry-pick 62ecb3Copy the code
8. Merger and derivatives
Git merge dev-xtheirs # Merge the dev branch into the current branch. Git rebase <branch> # derivatives specifies a branch to the current branchCopy the code
9. Remote operation
Git remote add <remote> <url Git pull <remote> <branch> Git push :<branch/tag-nameCopy the code
Pack 10.
git archive --format=zip --output .. Git archive --format=zip --output... git archive --format=zip --output... Git archive --format=zip v1.2 >.. git archive --format=zip v1.2 >.. /v1.2.zip # does the same as the previous commandCopy the code
11. Configure global and local configurations
The global configuration is saved at: $Home/.gitconfig. The local repository configuration is saved at:.git/configCopy the code
12. Remote and local merge
Git commit -m "add local source" # git pull origin master # Git push -u origin masterCopy the code
NPM common commands
1. The commonly used
Installation package, the latest version will be installed by default
npm install gulp
Copy the code
Install the specified version
NPM install [email protected]Copy the code
-s, –save Add installation package information to Dependencies
NPM install gulp --save or NPM install gulp -sCopy the code
-d, –save-dev the installation package information is added to devDependencies, so it is generally used during development
NPM install gulp --save-dev or NPM install gulp -dCopy the code
NPM uninstall Uninstalls modules
Basic grammar
npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|-D|--save-dev|-O|--save-optional]
aliases: remove, rm, r, un, unlink
Copy the code
NPM update Updates the module
npm update [-g] [<pkg>...]
Copy the code
NPM ls View the installed modules
npm ls [[<@scope>/]<pkg> ...] aliases: list, la, llCopy the code
View globally installed modules and dependencies
npm ls -g
Copy the code
NPM init bootstrapping creates a package.json file in your project
npm init [-f|--force|-y|--yes]
Copy the code
NPM help Displays the detailed help information about a command
npm help <term> [<terms..>]
Copy the code
npm rootView the installation path of the package
npm root [-g]
Copy the code
NPM start Starts the module
Basic grammar
npm start [-- <args>]
Copy the code
NPM stop Stops the module
npm stop [-- <args>]
Copy the code
Yarn Common commands
Yarn Common commands
NPM install === yarn -- install Install is the default behavior. NPM install taco --save === yarn add taco -- The taco package is immediately saved to package.json. npm uninstall taco --save === yarn remove taco npm install taco --save-dev === yarn add taco --dev npm update --save === Yarn upgrade NPM install taco@latest --save === yarn add taco NPM install taco --global === yarn global add taco -- As always, use the global tag with caution.Copy the code
This command is unique to Yarn
Yarn licenses licenses generate - Yarn licenses why Taco - Check why taco is installed Yarn WHY Vuepress -- Check why vuepress is installed and list all other packages that depend on itCopy the code