git commandsgit statusgit add filenameGit commit-m ' Zhushi 'The address of GIT remote origin repositoryAddress of the Git clone repositoryGIT branch--set-upstream-to= remote repository name/branch name local branch name #关联分支Git pull Merge branch is required before #git pus
1: Modify User.Name and User.email that have submitted N-Times codeFix me in multiple computers, using different accounts, git config global,system,local configuration ignored changes, and added a number of computer SSH key default submission problem.# Two copies perform the following two linesgit filter-branch-f--env-filter "git_author_name= ' Wujuguang '; Git_author_email= ' [EMAIL protected] ';Git_committer_name= ' Wujuguang '; Git_committer_email=
1. Cancel tracking of certain files or folders:
Delete an object:
$ Git Rm -- cached filename
Delete a folder:
$ Git Rm-r -- cached path
2. Ignore some files or folders
$ VI. gitignore
Every row in the file is an ignored item.
AA. Log, ignore AA. log;
*. Log: Ignore files ending with. log;
Pod/*, ignore all folders under the pod directory
3. Merge multiple commits:
$
Git The basic common commands are as follows:MKDIR:XX (Create an empty directory XX refers to the directory name)PWD: Displays the path to the current directory.Git init turns the current directory into a manageable git repository, creating a hidden. git file.git add xx adds xx files to the staging area.Git commit–m "X
First, use Git branch to create a branchUsage Scenario: No experience at the momentGit branch-a Show All branchesGit branch xx create XX branchgit checkout xx switch to XX branchGit checkout-b xx Create and switch to XX branchSecond, use Git stash save and restore work progressUsage scenario: Develop a new feature that has not been developed yet, but need to fix a bug urgently, you can save this progress, f
1. Create a new library with git and submit a file1 Touch readme.md // This is the command to create a new file in the folder you want to native 2 git init // Initial session local library 3 It add readme.md // adding files to the library 4 git commit-m "First commit" // submit 5 git remote add origin [emai
Git init: Turn the current directory into a repository that git can managegit add: Tell git to add files to the repositoryGit commit-m "": Submit the file to the repositoryGit status: View the current state of the warehousegit diff filename: see what the filename file has changedgit diff HEAD--filename: View the latest version of filename and workspace in the rep
Common git commands
Find a good summary blog, please refer to: http://blog.csdn.net/ariesjzj/article/details/7747876
Git Add: tracks new files, stores tracked files in the temporary storage area, and marks conflicting files as resolved during merge.Git status: Check the current file statusGit DIFF: compare the difference between the current file in the working di
NOTES: # Note: The # in #!/bin/bash at the beginning of the shell file is not a comment run: 1, bash shell.sh 2, chmod +x shell.sh./shell.sh 3, add to Path change Amount of 4,. ./shell.sh Troubleshooting: 1, syntax error when running with prompt 2, logic error using echo printing, Sleep Number: Sleeping number seconds, reduce the cycle speed using Bash-x To debug a shell script third-party tools: Bashdb bui
redirectionStandard input: Code 0, using Standard output: Code 1, using > or >>Standard error Output: Code 2, using 2> or 2>>1>: Output the correct data to the specified file or device in an overriding way1>>: Output the correct data to the specified file or device in an additive way2>: outputting the wrong data to the specified file or device in an overridden manner2>>: The incorrect data is output to the specified file or device in an additive way4. The judgment basis of the command execution
How do I get ssh Key?The first time you get the remote git code, there is no SSH key locally and can be generated using the following command (note: yufeng.x is the user name):ssh-keygen -t rsa -C "yufeng.x"Always press ENTER and finally get two files: Id_rsa and Id_rsa.pubYour identification has been saved In/users/xieyufeng/.ssh/id_rsa.Your public key has been saved in/users/xieyufeng/.ssh/id_rsa.pub.To display SSH key via the cat command:cat /Users
MKDIR:XX (Create an empty directory XX refers to the directory name)PWD: Displays the path to the current directory.Git init turns the current directory into a manageable git repository, creating a hidden. git file.git addxx add xx files to staging area.Git commit–m "XX" commits a file –m followed by a comment.Gitstatus View Warehouse Statusgit diff xx View xx file modified those contentGitlog View HistoryG
parameters, this way, it rolls back to a version, only retains the source code, fallback commit and index informationgit reset--soft: Fallback to a version that only returns the commit information and does not revert to the index file level. If you want to submit it, you can do it directly.git reset--hard: Completely fallback to a version, the local source code will also become the previous version of the contentgit reset head^: The default reset method, which points to the last commit before H
Create git spacegit initset The local cofiggit config--global user.name "xx" git config--global user.email "[Email Protec Ted] "Set the remote Urlgit Remote add Origin https://git.oschina.net/xx/aaa.gitdownload file:git fetchcreate the local bra Nch to link to the remote Branch:git checkout-b master origin/master Add new file:git add Filenamegit commit ... git pu
Git common command 2 Add remote repositories (take GitHub for example)Login to the official website https://github.com, if not, go to register an account.Then create a new warehouseIn the repository name fill in learngit , the other remains the default settings, click the "Create Repository" button, the successful creation of a new Git repository:At the moment, this warehouse on GitHub learngit is still emp
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.