, which is the default origin18, Git branch: View branch.Add:Git branch--set-upstream branch-name origin/branch-name: Create a link relationship between the native branch and the remote branch.Git branch--set-upstream-to=o/server_side_branch_name your_branch_name19, Git branch 20, Git checkout Add:git checkout git checkout "@{10 minutes Age}": Switch to version 10 minutes ago (Commit-id)Git checkout "@{5}": Switch to the 5th to the bottom of the Commit-id.21, Git checkout-b Add:Equivalent to the
In ~ /Directory
Create or modify a file gedit. gitconfig
Copy the following to the default configuration.
[Color]
Ui = auto
[User]
Name = w22ee
Email = w22ee@126.com
[Alias]
St = Status
Ci = commit
BR = Branch
CO = checkout
CVSup =! Sh-C \ "Git stash git cvsimport-v-K-I git rebase origin git stash pop \"
Svnup =! Sh-C \ "Git stash git SVN rebase git
Git rm Git rm -- cached
Storage and recovery
Git stash # store the current jobGit stash list # view the storage siteGit stash apply # restore the work site. The stash content is not deleted.Git stash pop # restore the work site and delete the
branch. You can merge them on the dev branch from time to time.
3. Bug Branch
Git provides a stash function to "Store" the current work site and resume the work after it recovers:
$ git stash
Restore and delete the stash after fixing the bug.
$ git stash pop
View stash
$ gi
' 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
) (delete an associated remote database name)Git remote-V (list the names of associated remote libraries)Git clone [email protected]: path/repo-name.git (clone a remote library to a local, clone the master branch by default)Git checkout-B Dev origin/dev (create a local branch, switch to the branch, and associate the branch of a remote database to the local branch)Git log -- Graph (view branch merge graph)Git merge -- no-FF-M "merge with no-FF" branch nameGit
details stash // a cache mechanism Status // view git status gitk // graphical interface to view all the COMIT of the current branch, similar to the gitlog GUI version
Most git commands require the current directory (or the ancestor directory of the current directory) to exist. the GIT folder can be executed only in the following situations: 1. git config -- Global xxxx // git global settings 2. git init // initialize git3. git clone // copy Reposito
-commitWhen a bug is temporarily modified, to ensure that the current workspace looks cleanTo store the current unfinished work site.Git stashView a stored workspacegit stash List[Email protected] {0}: WIP on b1:38b2a71 Modify p.phpRecovering a stored workspacegit stash apply [email protected]{0} (after recovery stash content is not deleted) need to use Git
filesgitls-files-tShow all untracked branchesgitls-files--othersShow all ignored filesgitls-files--others-i--exclude-standardgitcheck-ignore*gitstatus--ignoredManipulation: OperationStops tracing a file but does not delete it.gitrm--cachedOrgitrm--cached-rForce Delete untracked files or directoriesgitclean-fgitclean-f-dgitclean-dfClear. gitignoregitclean-X-fChanges: ModifyInfo: View informationView unsaved files after last submissiongitdiffView the files for temporary changes to be submittedgit
the stage.2.2 then execute git rebase-continue to directly create another patch.Repeat 2.1, 2.2 Until rebase is complete. Note that the rebase does not need to explicitly execute commit. Commit is automatically completed by git.3. You can use git diff to view conflicts. Git diff has different meanings in different scenarios.
Git pull:
It is equivalent to git fetch + git merge. If git merge is a quick merge, a commit point is formed.The commit point corresponding to git merge can be referred to
.; Git add-u;Git add-a4. Submission:(1) From staging area I to local warehouse Lgit commit-m [Submit message](2)5. Revocation(1) From staging area I to work area Wgit rm--cached (2) Revert to head versiongit reset--hard HEAD(3) Modify the submitted user name informationgit commit--amend--author= "author Name 6. Remote(1) Change the remote warehouse addressgit remote Set-url origin http://xxx.xx.com/x.git(2) View Remote warehouse logsgit log origin/master(3) Compare local and remote branchesgit d
demand, suddenly this self-happy development way is interrupted, a test branch has a bug needs to be repaired immediately, wipe, the local code has not been submitted, but do not want to because of the temporary submission of local code to describe how the temporary submission of the description. You can then use Git stash to access locally changed code, and then switch to the bug's branch to solve the problem, and finally go back to this point using
, 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 project owner can analyze the program and give certain naming rules. For example, some projects are named based on the functional namespace and some projects are named based on the owner name. However, no matter which method is used, a reasonable namespace will not be reconstructed due to name conflicts when you cooperate with many people in large projects. Therefore, the js file in your site will include the namespace. js introduced first, which defines all namespaces and management for th
commits, you need the following command
1
git rebase -i HEAD~2
Using this command, you will enter an interactive interface that shows the last two commits, and asks you which to compress. The ideal state is your pick last commit and commit it and the previous one squash .Next you will be asked to fill in the descriptive information for the combined submission. This process actually overrides your commit history.8. Save changes that have not yet been submittedFor
for all branch history # git revert modification corresponding to the submission history # undo commit dfb02e6e4f2f7b573337763e5c0013802e3 92818git ls-tree HEAD # Internal Command: display a git object git rev-parse v2.0 # Internal Command: Display SHA1 HASHgit reflog for a ref # Show All commits, including the isolated node git show HEAD @ {5} git show master @ {yesterday} # display the status git log of the master branch yesterday -- pretty = format: '% h % s' -- graph # submit the log git sh
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.