Difference between HEAD / Working Tree / Index in Git
来源:互联网 发布:mdf数据库恢复 编辑:程序博客网 时间:2024/06/05 06:36
转载至http://stackoverflow.com/questions/3689838/difference-between-head-working-tree-index-in-git
A few other good references on those topics:
- My Git Workflow
I use the index as a checkpoint.
When I’m about to make a change that might go awry — when I want to explore some direction that I’m not sure if I can follow through on or even whether it’s a good idea, such as a conceptually demanding refactoring or changing a representation type — I checkpoint my work into the index.
If this is the first change I’ve made since my last commit, then I can use the local repository as a checkpoint, but often I’ve got one conceptual change that I’m implementing as a set of little steps.
I want to checkpoint after each step, but save the commit until I’ve gotten back to working, tested code.
- Why Git is better than X
- Git Is Your Friend not a Foe Vol. 3: Refs and Index
They are basically named references for Git commits. There are two major types of refs: tags and heads.
- Tags are fixed references that mark a specific point in history, for example v2.6.29.
- On the contrary, heads are always moved to reflect the current position of project development.
Now we know what is happening in the project.
But to know what is happening right here, right now there is a special reference called HEAD. It serves two major purposes:
- it tells Git which commit to take files from when you checkout, and
- it tells Git where to put new commits when you commit.
When you run
git checkout ref
it pointsHEAD
to the ref you’ve designated and extracts files from it. When you rungit commit
it creates a new commit object, which becomes a child of currentHEAD
. NormallyHEAD
points to one of the heads, so everything works out just fine.
- Difference between HEAD / Working Tree / Index in Git
- Difference between Key, Primary Key, Unique Key and Index in MySQL
- What the difference between rebuild index and re-organize index?
- Difference between Full Index Scans and Fast Full Index Scans
- Difference between BTree and B+Tree
- 在git提交环节,存在三大部分:working tree, index file, commit
- Difference between STA and MTA in thread
- difference between VARCHAR NVARCHAR in SQLite
- Difference between Externalizable and Serializable in Java
- Difference between Vector and ArrayList in java?
- Difference between Comparator and Comparable in Java
- Difference between TreeMap and TreeSet in Java
- Difference between RegularEnumSet and JumboEnumSet in Java
- Difference between __str__ and __repr__ in Python
- Difference Between Thread and AsyncTask in Android
- Difference between Comparator and Comparable in java
- Difference between Stack and Heap in Java
- Difference between dialog and session in SIP?
- leetcode--Sudoku Solver
- freemarker错误总结
- 正则表达式工作原理
- Windows8和Windows10系统改装Win7系统的问题和解决办法
- RTSP协议(一)
- Difference between HEAD / Working Tree / Index in Git
- C++primer 4.4 多维数组、指针数组、数组指针(未完)
- char或unsigned char给int赋值区别
- linux下mysql中文乱码问题
- 如何在Qt Creator中调试Ubuntu Scope
- Linux下用memory方式访问PCIE空间
- webview中html页面开发注意事项
- linux下解决mysql区分大小写问题
- Android中moveTo、lineTo、quadTo、cubicTo、arcTo详解(实例)