Installation
Install the latest version of Git on CentOS 7:
yum remove git
yum install epel-release
yum install https://centos7.iuscommunity.org/ius-release.rpm
yum install git2u
Configuration
git config --global core.editor "/usr/local/bin/mvim -v"
Commit Message Format
- A Note About Git Commit Messages
- Linus’ comment
- Erlang Commit Message Convention
- AngularJS Team
- Git Commit Messages : 50/72 Formatting
- git-scm-book
- SubmittingPatches
Protocols
- Local protocol such as
/srv/git/project.git
andfile:///srv/git/project.git
- HTTP protocols such as
http://git.haproxy.org/git/haproxy-1.9.git
andhttps://chromium.googlesource.com/external/webrtc
. - SSH protocol such as
git@github.com:yaojingguo/c-code.git
andssh://git@github.com/yaojingguo/c-code.git
- Git protocol. A URL is prefixed with
git://
.
Tips
- Easy way to pull latest of all git submodules
- How can I merge two commits into one?
- Git merge: accept theirs for multiple conflicts
- git pull while not in a git directory
git push origin --delete <branchName>
To see an old version of a file, use git show REVISION:path/to/file
.
For example, to show the 4th last commit of the file src/main.c, use
git show HEAD~4:src/main.c
.
- How to git bundle a complete repo
$ git bundle create repo.bundle –all
Text File Merge
Conflicts if:
- Both branches modify the same line
- Two branches modify continuous lines. For example, branch A modifies line 1. Branch B modifies line 2.
No conflicts if:
- One branch modifies one line. The other branch add a new line.
- Both branches add new line (adding lines means inserting lines or appending lines).
Proxy
The following configuration impacts both HTTP and HTTPS git URLs. But a
http_proxy
environment variable only applies to Git HTTP URLs. https_proxy
environment variable only applies to Git HTTPS URLs.
A HTTP proxy is used:
[http]
proxy = www.proxy.com:80
Or a SOCKS5 proxy can also be used:
[http]
proxy = socks5://127.0.0.1:1080
The above configuration is equivalent to http.proxy
. There is no https.proxy
for Git.
Shadowsocks client listens on socks5://127.0.0.1:1080
by default. Proxifier is
not needed.
Pack
- Xdelta
- RFC: rfc3284
- Is the git binary diff algorithm (delta storage) standardized?
- diff-delta.c
- How does the rsync algorithm work?
Diff
- Diff Algorithm [closed]
- Investigating Myers’ diff algorithm: Part 1 of 2
- Investigating Myers’ diff algorithm: Part 2 of 2
- The Myers diff algorithm: part 1
- Git是怎样生成diff的:Myers算法
- Reimplementing “git clone” in Haskell from the bottom up
- What’s the difference between
git diff --patience
andgit diff --histogram
? - Longest Common Subsequence
##
package main
import "fmt"
func main() {
fmt.Println("hello, world")
}
Remve the line for Println. git diff
produces:
diff --git a/main.go b/main.go
index 50e8d8d..ba4f19d 100644
--- a/main.go
+++ b/main.go
@@ -3,5 +3,4 @@ package main
import "fmt"
func main() {
- fmt.Println("vim-go")
}
makeNodeMetrics
writeFileSyncing
MISC
- Re: Minimum git commit abbrev length
- How can I tell if a given git tag is annotated or lightweight?
➜ cockroach git:(master) git cat-file -t beta-20160629-freebsd tag ➜ cockroach git:(master) git cat-file -t refs/tags/v2.0-rc.1 commit ➜ cockroach git:(master) git show-ref -d --tags ... b638cc8a55ed7f0d4ed06b4fde3ee1070afb2f28 refs/tags/beta-20160629-freebsd 7a926019716abd7b4eb642d803c7000c0c89cd64 refs/tags/beta-20160629-freebsd^{} ...
- How can I list all lightweight tags?