➜ git-exercise git:(test-a) git checkout main Switched to branch 'main' Your branch is up to date with 'origin/main'.会先提示你要不要在merge前pull ➜ git-exercise git:(main) git merge test-a Merge made by the 'recursive' strategy. branch-a-1.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 branch-a-1.txt
DESCRIPTION Incorporates changes from a remote repository into the current branch. In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.
More precisely, git pull runs git fetch with the given parameters and calls git merge to merge the retrieved branch heads into the current branch. With --rebase, it runs git rebase instead of git merge.
<repository> should be the name of a remote repository as passed to git-fetch(1). <refspec> can name an arbitrary remote ref (for example, the name of a tag) or even a collection of refs with corresponding remote-tracking branches (e.g., refs/heads/*:refs/remotes/origin/*), but usually it is the name of a branch in the remote repository.
Default values for <repository> and <branch> are read from the "remote" and "merge" configuration for the current branch as set by git-branch(1) --track.
Assume the following history exists and the current branch is "master":
A---B---C master on origin / D---E---F---G master ^ origin/master in your repository
Then "git pull" will fetch and replay the changes from the remote master branch since it diverged from the local master (i.e., E) until its current commit (C) on top of master and record the result in a new commit along with the names of the two parent commits and a log message from the user describing the changes.
:
3. see commit
1 2 3 4 5 6
git log git log -p git log --stat git show git show 953f #至少4位 git diff --staged
这一节介绍了一些查看改动内容的方法,大致有这么几类:
查看历史中的多个commit:log
查看详细改动: git log -p
查看大致改动:git log --stat
查看具体某个commit :show
要看最新 commit ,直接输入 git show ;要看指定 commit ,输入 git show commit的引用或SHA-1