1. Git Common commands: Fast query gitbranch view all local branches gitstatus view current status gitcommit submit gitbranch-a view all branches gitbranch-r view all remote branches gitcommit-am quot; init quot; submit and add comments to gitremote
I. Quick query of common Git commands
Git action notes 1. Create directory $ mkdir learngit $ cd Learngitnbs p; 2. Change the new directory to warehouse $ git init 3. Add a file to the repository N Bsp $ git add readme.txt 4. Submit one or more files together to the repository $ git commit-m "wrote a readme fil E " 5. View the statu
git command practice, git commands
One, the order
git checkout-b branch name//Create branch and switch to that branch
Git checkout branch name//switch to this branch
Git merge branch name//merge branch into current branch
ObjectiveI have always wanted a piece of this stuff, because when I first contacted, I also carefully read the Liaoche tutorial, but it seems I think a little bit more, and will bring me a lot of redundant and repetitive operating burden, so I hope to compress it in my work cost, but search for a while did not find a satisfactory tutorial, A new year to comb your own experience.Maybe the boys are more big G
Protected]:schacon/Simplegit.git* [New tag] v1.5V1.5If you want to push a lot of tags at once, you can also use --tags commands with options git push . This will send all the labels that are not on the remote repository server to that place.$ GIT push origin--tagscounting objects:1, Done. Writing objects: -% (1/1), thebytes |0BYTES/S, Done. Total1(Delta0), reuse
Git is different from a version management system like SVN. Although familiar with common operations, it can satisfy most of the requirements. However, it does not rely on brute force to try it in case of troubles, it is necessary to understand the principles of git.File
All file version information managed by git is stored in the root directory.gitNext, let's take a look:
$ ls .gitCOMMIT_EDITMSG HEAD
Previously useful, but relatively few, this brother hope our project code is uploaded to GitHub, the new brother will not use GitHub, let me give science, let them get started. Just as I just reinstall the system, the process of installing git from scratch and the first push code to GitHub is recorded:1. Download and install git (windows7)Download Git:https://www.git-scm.com/download/winClick on the exe fil
files from the current trace list and remove them completelygit rm readme.txt#Delete only in staging area, keep files in current directory, no longer trackgit rm–cached readme.txt#Renaming Filesgit mv reademe.txt Readme#View the history of a submissiongit log#Modify the last commit comment, using the –amend parameterGit Commit--Amend#forgetting to commit some changes, the following three commands will only get one commit.
test file and directory under the current directory is ignored, and the subdirectory's test is not in the Ignore rule:*.[ OA] Description: Ignores all file rules that end in. O or. A:**/node_modules/ Description: Ignores all folders named Node_modules, and writes directly Node_ Like modules/ .3. Example:Rules: /* !/test /test/* !/test/inner.js Description: Ignores all content, but does not ignore/test directories and/test/inner.js files under the root directory
Http://www.xbc.me/git-commands/ Get git Repository
Initialize a version Repository
Git init
Clone remote version Library
Git clone git@xbc.me: WordPress. Git
Add the remo
bbaf6fb5060b4875b18ff9ff637ce118256d6f20, we executed the 'git reset bbaf6fb5060b4875b18ff9ff637ce118256d6f20 ', then the result is only three submitted versions of the A-C.
Differences between git revert and git Reset
Git revert is used to cancel an operation. The commit before this operation will be retained.
the local trace branch.
Git branch-d [local-branch-name]and delete the same command as the local branch.
Branch Management Commands
Create, toggle, view a branch
Suppose Dev is to create a branch name.
Git branch//view branch
git branch dev//Create branch
git checkout
BranchesGit branch-r# Start Tracking One remote branchGit branch--track some_branch origin/some_branch# Change to the branch locallygit checkout Some_branch# make changes and commit them locally....# Push your changes to the remote repository:git pushTo create a remote branch# Create a new branch locallyGit branch Name_of_branchgit checkout Name_of_branch# edit/add/remove Files # Commit your changes locallygit add fileNameGit commit-m Message# Push changes and new branch to remote repository
Create a label
ID"blablabla ... " "blablabla ... "
Action Label
-D v0. 1 --tags Delete remote tag git push origin:refs/tags/v0. 9 ---D can delete a local tag;? command git push origin:refs/tags/
Using GitHub
True----The settings of global user.email email and so on.
Ignoring special files
? When you omit certain files, you need to write. gitign
Some of Git's basic commands
Common git commands
Make sure that you have installed the GIT client
General Configuration
git--version //view git version info
git config--global u
Git basic tutorial
The following is actually a basic tutorial for Git use within the company. I will record it here.
Modify Git configurationsWindows operating system line feed Configuration
git config --global core.autocrlf inp
Android Advanced Intermediate Tutorial--1.1 git's local usagetags (space delimited): Android advanced1. IntroductionIn the previous Android Basics series we explained the simple use of Git, the Advanced series weA systematic explanation of git, the use of basic commands, the concept of workspaces, staging area, histori
branch-D branch name (delete Branch)Git branch-D branch name (Force Delete Branch)Git pull (capture the latest commit)Git Branch -- Set-upstream Dev origin/dev (specify the connection between the local branch and the remote Branch)Git reset head readme.txt (clear readme.txt content in the temporary storage area)
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.