). 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 of the work tree are lost. Therefore, this option should be used with caution, unless you
the mode to be disabled, Fast forward git will generate a new commit at merge, so you can see the branching information from the branch history.
To prepare the merge dev branch, note --no-ff The parameter, which indicates disabled Fast forwar :
$ git merge--no-ff-m "merge with No-ff" Dev
You need to add-m to it because a new branch is created and you need to add a description
13.bug Branch: official website from Liaoche
Each bug should be handled using a single branch:
Master is the main branch of the project, points to the project version, head is the latest version of the main branch of the project, pointing to the main line namegit checkout-b Dev//Create the Dev branch and switch to the branch, equivalent to:Git branch Dev//Create a branchgit checkout Dev//Switch BranchesGit branch//View Current Branchgit merge Dev//switch to the other, then merge the Dev branch into the current branchgit branch-d Dev//Remove Dev Branchgit log--graph--pretty=noline--abbrev-
The above command is equivalent to git branch newbranch and git checkout newbranch
2. Run the GIT branch command to view the current branch.
3. merge a branch to the current branch: git merge name
4. Delete branch: git branch-D name
5 disable fast forward: Add-no-FF to merge
If possible, git uses the "Fast Forward" mode when merging branches, but in this mode, branch information is lost after the branches are deleted. If you want to forcibly disable the "Fast Forward" mode, git will generate
] => occasional [28] => no best [30] => sedated incorrect operation [31] => The lighter the better [33] => The Last Resort was to change the route [34] => at will [35] => Shashi Road [36] => easy and comfortable [40] => never happened [43] => compete for the same lane, freely throwing garbage, changing lanes and turning without lights [44] => without seat belts, driving with slippers, driving, smoking, and drinking, without using children's seats [45] => keep speed, regular maintenance, selectio
is invisible to others:Git push originUpdate and mergeTo update your local repository to the latest changes, execute:Git pullTo get (fetch) in your working directory and merge (merge) remote changes.To merge other branches to your current branch (for example, master), execute:Git mergeIn both cases, git tries to automatically merge the changes. Unfortunately, this may not succeed every time and may result in conflicts ). At this time, you need to modify these files to manually merge these confl
Thanks to Liaoche, the great God shared git lessons
Master the following commands, basically daily enough local warehouse common operation to create a repository
Git init Add file to buffer
Git add file to warehouse
Git commit-m "Commint describtion" undo Modify or clear buffer
git reset/git reset HEAD file Discard or undo changes
Git checkout--file Delete
git rm fileEquivalent to git rm after git add undo Delete Operation
git resetgit checkout--file view specified file
Git cat file comparison w
Branch
Create branch: git branch name
Switch branch: git checkout name
Create + switch branch: git checkout-B Name
Merge a branch to the current branch: git merge name
Delete branch: git branch-D name
11. Merge conflicts
When git cannot automatically merge branches, the conflict must be resolved first. After resolving the conflict, submit it again and merge it.
Run the GIT log-graph command to view the branch merge graph.
-- No-FF parameter, disable "Fast Forward": git merge -- no-FF-M "merge
--no-ff parameter can be combined with the normal mode, the merged history has branches, can see that there has been a merger, and Fast forward merge will not be seen to have been merged. (8) Staging management: When fixing a bug , we fix it by creating a new bug Branch, then merging and finally deleting the branch. When the work is not finished, first put the work site git stash , and then go to fix the bug, repair, then git
File: New filegit stash -uShow All stashesgit stash listGo back to the state of a stashgit stash apply {n}>Go back to the last stash state and remove this stashgit stash popDelete all the stashgit stash clearTo take out a file mo
repeat.Reference Address: http://www.takobear.tw/12/post/2014/02/bear-git-flow-sourcetreegit-flow.htmlSecond, create branch branch with command-lineCond......----------------------------------------------------------------------Split Line-------------------------------the following tips----------- ------------------------------------1, Git stash commandSpeaking of branches, using git to develop more complex projects I think there will be a number of
' detached head '. Can look around, make experimental
changes and commit them, and can discard any commits
Tate without impacting any branches by performing another.
If you are want to create a new branch to retain commits you create, your may does so
(now or later) by using-b with the Che Ckout command again. Example:
git checkout-b
Re-executiongit branch
* (head detached at 945A2F9)
3.0
3.2
unstable
You can see that you are on a temporary branch and if you want to dev
time cloning a copy of the code in the/home/le/workspace/git/repo2/directory of the B machine
$ git clone-b scala_dev le@192.168.6.1:/home/le/workspace/scala_test
$ git Branch #查看当前分支
#提交新的代码
$ Touch Test3.scala$ git Add Test3.scala$ git commit
$ git log #在push之前确认commit是否正确
$ git push
6. Back to/home/le/workspace/git/repo2/Update code
$ git pull #如果有错误, follow the error prompts to modify the. git/config fileB. Some issues that may be encountered 1. Merging multiple commits one commit has been
distant library
Git push–u (not required for the first time with-U) Origin master pushes the current master branch to the remote library
git clone https://github.com/idoxu/testgit cloning from a remote repository
git checkout–b dev Create dev branch and switch to Dev branch
Git branch view all current branches
Git checkout master switches back to the master branch
git merge dev branches on the current branch
git branch–d dev Delete Dev branch
GIT branch name to create a branch
Git
, delete, retrieve, reset modified files
git help
View File diff
git help
View Commit record
git log git log
TIG
you can use TIG instead of diff and Log,brew install TIG on your Mac
Git Local Branch ManagementView, toggle, create, and delete branches
Git br-r # View remote branch
git BR
Branch Merging and Reba
git merge
git patch management (for easy development of synchronization on multiple machines)
git merge
git Staging tube
Git
Forward模式,导致合并后删除原来的分支后,看不出主分支曾经合并过存档list恢复存档git stash apply 存档id删除存档git stash drop 存档id上面的恢复和删除可以用下面的命令合并操作git stash pop 存档id
When working in the current branch for a period of time temporarily need to switch to another branch, but the contents of the current branch cannot be submitted, this time can be used to use the command to log
, so with the-m parameter, write the commit description in:$ git merge--no-ff-m "merge with No-ff The Dev"Store" The current Job site:$ git stashview a list of stored work sites:$ git stash listRestore the "storage" work site and also delete the stash content:$ git stash popRestore the "storage" work site without deleting sta
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.