Git local repository synchronized to remote repository$ git Remote add Origin http://github.com/powfulCsharp/NuUserControl.git$ Git push-u Origin MasterClone a remote repository to a local using git clone +urlCreate a branch in a remote repository with git branch+ branch name to move out of branch with git checkout + branch nameUsing git add filename git commit-m "" will not find changes when switching to the main version after modifying the file on the branchMerge the changes in the branch into
bug -- 013. Fix the bug, merge the bug branches, and delete the bug branches.Git merge bug -- 01Git branch-d bug -- 014. Go back to dev, view stash, delete stash, and continue to work.Checkout devGit stash listGit stash apply recoveryGit stash pop recovery and Deletion5. Fo
simple classification of GIT operations, as follows--
Remote Repository class: Git clone/remote/pull/push/rebase/fetch
Branch class (including tag): Git Branch/tag/checkout/stash
Information lookup: Git status/log/diff
Local normal operation: Git add/commit/rm/merge/reset
Here is just my personal classification, everyone has a different classification of it, welcome to add.What you need to emphasize is that you need to have
processed
Git push Origin branch name
11. Submit the Merge Request
After submitting the merge request, the code approval team colleagues will review the submitted code, and no problem will agree to merge requests and merge the code from the test branch into the master branch
Git using tips
The use of Stash
Sometimes there is a scenario where you develop a feature on a local branch and there is an urgent bug that needs to be handled,
/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 repository
Git commit-m "whrote a Readme file" submitted to the warehouse
Git status check the current state of the repository, tell Readme.txt to modify it, but not ready to commit
Git diff readme.txt display changes similar to Linux diff command
Git log shows
: master. You can view the status of the version library.$ Git status
2. add files to version library management (add)$ Git add. # add all files$ Git add filename # add a specified fileYou can also use git add to modify files.
3. Submit changes (commit)Use the commit command to submit the changes. remarks are required.$ Git commit-m "description"
4. Temporary changes (stash)Store changes that have not been submitted in the workspace to the temporary s
lack of any library files to install the appropriate library files.2. "Make make install", I encountered a troublesome error, yesterday afternoon the whole afternoon was not resolved, so the article is mainly to share this error and write.Error content: makefile:797: * * * must install Libyuv-dev to build MOD_FSV. Stop it.Solution:(1) Download LIBYUV source code and compileCD Freeswitch/libsgit clone https://freeswitch.org/stash/scm/sd/libyuv.gitCD
branch and switch to the pastgit Co-b #Create a new new_branch based on branchgit Co$id #Checkout A history commit record, but without branching information, switching to another branch will automatically deleteGit Co$idb #Checkout A History submission record and create a branchgit br-D #Delete a branchGit br-d #Force a branch to be removed (a branch that has not been merged will need to be forced when it is deleted)Branch Merging and Rebasegit merge # Merge branch branches into the c
can be discarded
The command git reset HEAD file can undo the staging area modification (unstage), re-put it back in the workspace, and then use git checkout -- file the discard work changes.
The command git rm is used to delete a file, and if it is found mistakenly deleted, replace the version git checkout -- file in the workspace with the version in the repository, which can be restored with one click, regardless of whether the workspace is modified or deleted.
git branch -b T
1. In the event of a conflict, the following information is indicated:' c/environ.c ' would is overwritten by merge. Aborting.please, commit your changes or stash them before you can merge.This means that there is a conflict between the updated content and the locally modified content, either by committing your changes or by temporarily storing the local changes first.The process is very simple, mainly using the git
repositoryFor example:If the user works in a 8705c repository, the remote repository for 8703c is aliased:git remote add 8703C [email protected]:~/repo/8703c-ap.gitThen, you can get any branch of 8703c by using the alias 8703C in the 8705c version of the repository.git fetch 8703C//sync 8703c to 8705c version LibraryGit branch-a//Display all branch information for 8703c and 8705cgit chekcout--track 8703c/branch_aPull the remote branch of 8703C to the local repository of 8705c,and automatically
the last commit information for each branchgit br--merged # View branches that have been merged into the current branchgit br--no-merged # View branches that have not been merged into the current branchGit Co Git co-b git co-b Git Co $id # Checkout A history commit record, but without branching information, switching to another branch will automatically deleteGit co $id-B git br-d git br-d Branch Merging and Rebasegit merge git merge origin/master--no-ff # do not fast-foward merge so you can ge
switch to another branch, the content you edited on the previous branch is not visible.To merge two branches, use the git merge branchname command.The default merge is Fast forward mode, which discards historical information and discards historical information when the branch is deleted. If you use--NO-FF, you can disable the FF mode, and a new commit will be generated when you merge, and you can see the branching information from the branch history.git branch-d branchname Delete a branchWhen e
configured remote warehouse and the corresponding address git remote -v Add a remote repository git remote add [remote-name] [url] Capture data from a remote repository git fetch [remote-name] [branch-name] Push data to a remote repository git push [remote-name] [branch-name] View a remote warehouse information git remote show [remote-name] Renaming a remote repository git remote rename [old-name] [new-name] Delete a remote warehouse git remote rm [remote-name] Show existing labels git tag Sear
commandgit stashPost a work backup after a temporary cleanup workspace as a repository for urgent modification of defect scenariosgit stash listView the work site for backupgit stash applyResume work sitegit stash dropDelete the previous backup sitegit stash popRestore and then delete the previous backuprebase command
your project to the remote Web repository.Of course, we may sometimes have to copy from GitHub and make changes, and we can use git clone [email protected]:username/git-demo.git Copy to commit after the change. The illustration showsOf course, our teammates may have to submit new changes before we can use git pull to synchronize remotely, and then make changes on a new basis.At this point a complete git process is gone. git checkout-b to create a branch and jump, you can do the normal devel
. fallback$ git reset HEADDiscard staging Area changes, undo staging area's changes (Unstage), and re-return to the workspace$ git Reset--Hard head abandons the workspace and index changes, and the head pointer still points to the current commit. Undo the merge without commit, in fact the principle is to abandon the index and workspace changes, Because no commit changes exist only in the index and workspace. $ git reset--hard head^ is used to undo the contents of the commit (equivalent to git re
version number:Git reflogIgnore fileCreate a. gitignore file (named. gitignore in Windows).In the list of files and directories you don't want Git to track#例外的文件类型*.exe#例外的文件夹testdir/#例外文件 (not backed up)!my.pycBranch Management#新建分支:GIT branch Switch branches (preferably commit changes before, or stashing, or commit amending):git checkout New and switch to branchGit checkout-b # Merging the develop branches (with the--no-ff attribute, the child nodes of the merged branch all fit together)git m
normal mode, the merged history has branches, can be seen to have been merged, andfast forwardThe merger would not have been seen as a merger.$ git merge--no-ff-m "merge with No-ff" Devmerge made by the ' recursive ' strategy. Readme.txt | 1 + 1 file changed, 1 insertion (+)13.When fixing a bug, we will fix it by creating a new bug branch, then merging and finally deleting;When the work is not finished, first put the job site git stash , and then
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.