Common git operation commands and git operation commands
Record the common Git command operations in the work. A project is often developed by multiple people in collaboration. Using git is a required skill for developers. Below a
/learngit.gitSecond, git common commands"Basic Command"
mkdir creating a File cd file entry
Git init turns this directory into a repository that git can manage, generating. git files
git add readme.txt Adding files to the
, such as intermediate files generated at the time of program compilation, and so on.GIT provides a document-ignoring mechanism for writing document information in the working directory that you do not want to accept in git management in the. gitignore file in the same directory. For example: in the working directory there is an zh directory, if you do not want to add it to git management, then execute:echo
Git configuration and Common commands, git configuration Common commands
1. Configuration
1) download the git software online. I'm git-1.9.5-preview20150319.exe and TortoiseGit-1.8.14.0-64bit.msi.
After installation, click
Common git commands and git commands
1. Create a branch that is identical to the remote dev branch and switch
Git checkout-B zhaojigangDev origin/dev
2. Create a branch identical to the remote dev branch, track the remote dev branch, and finally switch
, and then submit (a bit like a SVN commit, you do not need to save the data first ). for files without track, you still need to add git. git commit -- Amend addition commit. A new submission will be performed on the same parent node as the current submission node, and the old submission will be canceled.
6. Git BranchGit branch can be used to
#添加当前修改的文件到暂存区
git Add.
#如果你自动追踪文件, including files that you have manually deleted with a status of deleted
Git add-u
#提交你的修改
git commit–m "your comment"
#推送你的更新到远程服务器, syntax for git push [remote name] [local branch]:[remote branch]
Git push Orig
Git remote-v
Submit your modified C code
#添加当前修改的文件到暂存区
git Add.
#如果你自动追踪文件, including files that you have manually deleted with a status of deleted
Git add-u
#提交你的修改
git commit–m "your comment"
#推送你的更新到远程服务器, syntax for git push [remote na
git resolves local conflicts
The process is very simple, mainly using the git stash command for processing, divided into the following steps to deal with.
1. Store local Modifications first
$ git stashThis allows all local modifications to be temporarily stored. is to use Git stash
(reference) as a parameter to the command. git revert HEAD: Undo the most recent commit. Git revert creates a new, reverse commit that you can tell git not to commit by using parameter-N.git rmgit rm file: Removes files from the staging zone and also removes the working directory. git rm--cached: Removes files from
Git is a powerful distributed versioning tool that applies not only to the source code for managing large open source software (such as Linux kernel), but also to managing private documents and sources (such as: Wsi-lgame-pro)
For more information about git, please refer to my previous blog: Git version management tool
First,
play the remaining patches.Git rebase--abort will terminate rebase, and the current branch will return to the state before rebase. 5. Cleanup 1) Delete
git rm "file info"//delete files from git cache
git rm file: Removes files from the staging zone and also removes the working directory.git rm--cached: Removes files from the staging area, but stays in the work
). This option allows you to reverse the already submitted thing to a state that has been updated but not committed (Updated butnot Check in). It is as if the Git-update-index command has been executed, but there is no git-commit command to perform.--hardThe contents and the index in the working tree are switched to the specified version location, which means that all the following contents and the contents
Reprint please specify the source: Alvin Lee's Blog: Http://blog.csdn.net/lihaoweiV
The git rebase command is powerful, and in the Git Authority Guide, change the order of submission, which teaches a very complicated method, using git reset ... git cherry-pick ... Wait for the order.
But if you use
A few important conceptsFirst, define several concepts:
WorkPlace: Work Area
Index: Staging Area
Repository: Local Warehouse/Repository
Remote: Repository
When cloning a project locally on a remote (such as GitHub) (assuming the project is named Gittest), you will see a directory named Gittest on the local directory with the Project code and a directory named . Git. What is a workspace, except for the .
of Git's unique commands:
4, some of Git's unique commands
git branch: Add, delete, and search operations on branches, such as ' Git branch new_branch ' will create a new branch called New_branch from the current working version, ' Git branch-d new_ Branch ' will force th
The current development of new projects using version control tools are basically git, old projects or SVN, online git resources are many, many and miscellaneous. I have compiled a study of git, hoping to help students who are learning about git.First, Git commands to recogn
Common git commands, git
Git statusGit add puts the workspace in the hold ZoneGit commit puts the hold zone into the version ZoneGit add submits all modified files to the hold ZoneGit commit-m "Remarks written when submitting" no referenceGit commit-a-m "Write remarks upon submission" directly submit the workspace to t
Strong push, which uses your local code to replace content in your git repository with a strong overlayGit push-fgit fetch--prune #这样就可在本地删除在远程不存在的branchMans Git-fetch--pruneAfter fetching, remove any remote tracking branches which no longer exist on the remote.-T,--tagsThe most of the tags is fetched automatically as branch heads is downloaded, but tags it does notPoint at objects reachable from the branch
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.