Skip to content

alinbxSorcerer/git-succinctly-with-notes

Repository files navigation

Conlusion

Supporting these centralized and distributed collaboration models was all Git was ever meant to do.

  1. The working directory,
  2. the stage,
  3. commits history(前面三个record和undo的动作)
  4. branches,
  5. and remotes

were all specifically designed to enable these workflows, and virtually everything in Git revolves around these components.

True to the UNIX philosophy, Git was designed as a suite of interoperable tools, not a single monolithic program. As you continue to explore Git’s numerous capabilities, you’ll find that it’s very easy to adapt individual commands to entirely novel workflows.

I now leave it to you to apply these concepts to real-world projects, but as you begin to incorporate Git into your daily workflow, remember that it’s not a silver bullet for project management. It is merely a tool for tracking your files, and no amount of intimate Git knowledge can make up for a haphazard set of conventions within a development team.

一级二级三级
0.Introduction
Faster commands
Stability
Isolated Environments
Efficient Merging
1.OverviewObjects:Functions:
1.working directoryconfigure
2.staging arearecording
3.Commit historyundoing
4.developmnent branchesbranch (non-linear)
5.remotesremote
2.ConfigurationUser Info
git config –global user.name
git config –global user.email
Editor
git config –global core.editor emacs
Alias
git config –global alias.ci commit
.inspect
git config -l
helpgit help log
man git-log
tldr git-log
3.Recoding Chaneges
Staging area
git add
git rm –cached
.inspecting
git status
git diff (–cached)
Commits
git commit
.inspecting
git log
git log –oneline <file>
git log <since> … <until>
Tagging commit
git tag -a v1.0 ‘stable version’
4.Undoing Changes
Woriking directory
git reset –hard HEAD
git clean -f (git rid of unstaged files)
.individual file
git checkout HEAD <file> (most frequent)
Staging area
git reset HEAD <file> (extra staged file)
(No –hard here)
Commits
.resetting
git reset HEAD~1
.reverting
git revert <commit-id> (created new commit )
.ameding
git commit –amend
5.BranchesManipulate brnaches
.listing branches
git branch
.creating branches
git branch <name>
git checkout -b <name>
.git/refs/heads/develop
.deleting branches
git branch -d, -D
Checking out branches
git checkout <branch>
.detached
git checkout -b <new-branch-name>
Merging branches
.fast-forward
git checkout master
git merge some-feature
.3-way merge
same as the above
.merge conflicts
<<<<<<HEAD
==================
>>>>> some-feature
Branches workflow
.types of branches
permanent or topic
.permanent_branch
master(public ), develop,
.topic_branch
feature and hotfix
Rebasing
git checkout some-feature
git rebase master
.interactive_rebasing
git rebase -i master
(Notice for rewriting)
6.Remote Repositories
Manipulate remotes
.listing remotes
git remote
git remote -v
.creating_remotes
git remote add <name> <path-to-repo.
.deleting_remotes
git remote rm <remote-name>
Remote branches
.fetching_remote_branches
git fetch <remote> <branch>
git branch -r
.inspecting_remote_branches
git log origin/master
.merging/rebsing
git checkout some-feature
git fetch origin
git merge origin/master
(littered with meaninglesss merge commits)
git checkout some-feature
git fetch origin
git rebase origin/master
.pulling
git pull origin/master (–rebase )
.pushing
git push <remote> <branch>
Remote workflow
.bare_repository
git init –bare <path>
.centralized_workflow
git fetch origin master
git rebase origin/master
git push
.integrator_workflow
github的模式
Conclusion
1.working directory
2.staging area
3.commit history
4.branches
5.remotes
  • detached

Note: checking out ‘1a’.

You are in ‘detached HEAD’ state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b <new-branch-name>

HEAD is now at 613ae49 Chapter 1: initial version (1a)

About

git succinctly 评注笔记

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published