learngitbranching.js pass record silver moonlight sea

http://learngitbranching.js.org/ is a website for learning git. It teaches novices how to use git step by step in a game mode. This article is a record of the git commands that I reviewed and learned during the game.

--------split line--------

submit:

  1. git commit: commit the current version
  2. git branch newImage: create a new branch newImage
  3. git checkout newImage: switch to branch newImage
    1. Parameter -b: Create a new branch and switch to the same time
  4. git merge bugFix: merge branch bugFix to current branch
  5. git rebase master: transplant the current branch to the Master branch and switch to the past
  6. git checkout commitHash: Move the HEAD to the specified commit by specifying the hash value of the commit (the first few are enough)
  7. git log: view commit history
  8. git checkout master ^: switch to the parent node of Master, HEAD is separated
  9. git checkout HEAD ~ 4: The current HEAD is pushed back 4 times, ~ is a relative reference
  10. git branch -f master HEAD ~ 3: Force to move to the parent 3 level of Master branch
  11. git reset HEAD ~ 1: The local temporary storage area cancels the last commit, but the code is still
  12. git revert HEAD: a new commit, to restore the code to the previous state

other:

  1. git cherry-pick c2 c4: copy the commits of c2 and c4 to the current branch
  2. git rebase -i HEAD ~ 4: Copy the previous 4 commits to the new branch in an interactive interface
  3. git commit --amend: modify this commit
  4. git tag v1 [C1]: tag [commit C1, default current HEAD] tag is v1
  5. git describe master: show <recent tag> _ <different commit times> _g <current commit hash>

Remotely:

  1. git clone: ​​clone remote library
  2. git fetch: Get the latest commit of the remote library locally without changing other branches
  3. git pull: equal to git fetch + git merge origin / master pull the latest commit of the remote library and merge to the local branch
  4. git push: local commit push to remote repository
  5. git pull --rebase: merge the latest commit of the remote library to the local, the local code is appended at the end
  6. git checkout -b foo origin / master: create local branch foo, trace remote branch Master
  7. git branch -u origin / master foo: associate branch foo with trace remote branch master
  8. git push origin master: push the local master branch to the remote origin / master
  9. git fetch origin <source>: <place>: update the latest code of the remote source library to the local place library, if the place does not exist, it will be created automatically

Guess you like

Origin www.cnblogs.com/gantoday/p/12723133.html