获取自最后一个tag以来的所有git提交(Get all git commits since last tag)
git log "$(git describe --tags --abbrev=0)..HEAD" --oneline
git log "$(git describe --tags --abbrev=0)..HEAD" --oneline --pretty=format:%s
git log "$(git describe --tags --abbrev=0)..HEAD" --oneline
git log "$(git describe --tags --abbrev=0)..HEAD" --oneline --pretty=format:%s
Ps:原文时间 2016-09-10 13:30
git add -A
和git add .
、git add -u
在功能上看似很相近,但还是存在一点差别
git add .
:他会监控工作区的状态树,使用它会把工作时的所有变化提交到暂存区,包括文件内容修改(modified)以及新文件(new),但不包括被删除的文件。git add -u
:他仅监控已经被add的文件(即tracked file),他会将被修改的文件提交到暂存区。add -u
不会提交新文件(untracked file)。(git add --update
的缩写)git add -A
:是上面两个功能的合集(git add --all
的缩写)下面是具体操作例子,方便更好的理解(Git version 1.x):
git init
echo Change me > change-me
echo Delete me > delete-me
git add change-me delete-me
git commit -m initial
echo OK >> change-me
rm delete-me
echo Add me > add-me
git status
# Changed but not updated:
# modified: change-me
# deleted: delete-me
# Untracked files:
# add-me
git add .
git status
# Changes to be committed:
# new file: add-me
# modified: change-me
# Changed but not updated:
# deleted: delete-me
git reset
git add -u
git status
# Changes to be committed:
# modified: change-me
# deleted: delete-me
# Untracked files:
# add-me
git reset
git add -A
git status
# Changes to be committed:
# new file: add-me
# modified: change-me
# deleted: delete-me
git add -A
:提交所有变化git add -u
:提交被修改(modified)和被删除(deleted)文件,不包括新文件(new)git add .
:提交新文件(new)和被修改(modified)文件,不包括被删除(deleted)文件New Files | Modified Files | Deleted files | Description |
---|---|---|---|
git add -A | ✅ | ✅ | ✅ |
git add . | ✅ | ✅ | ❎ |
git add -u | ❌ | ✅ | ✅ |
New Files | Modified Files | Deleted files | Description |
---|---|---|---|
git add -A | ✅ | ✅ | ✅ |
git add . | ✅ | ✅ | ✅ |
git add –ignore-removal | ✅ | ✅ | ❎ |
git add -u | ❌ | ✅ | ✅ |
发现 macOS 升级系统之后总会报错 git 找不到,无论是 macOS High Sierra ,还是 macOS Mojave。
错误信息:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
解决方法,重装 xcode CommandLineTools:
xcode-select --install
如果没有解决问题,执行以下命令
sudo xcode-select -switch /
t branch -m {{branch}}
git fetch origin
git rebase origin/master -i
git push origin {{branch}}
git checkout -b {{branch}}
git checkout -b {{branch}} origin/{{branch}}
<!– more –>
git checkout master
git merge {{branch}}
git branch -D {{localBranch}}
git push --delete origin {{remoteBranch}}
git remote -v
// View existing remotes
// origin https://github.com/user/repo.git (fetch)
// origin https://github.com/user/repo.git (push)
git remote set-url origin https://github.com/user/repo2.git
// Change the 'origin' remote's URL
git tag {{tag}}
git push --tags
// Set the HEAD to the old commit that we want to tag
git checkout {{leading 7 chars of commit}}
// temporarily set the date to the date of the HEAD commit, and add the tag
GIT_COMMITTER_DATE="$(git show --format=%aD | head -1)" git tag -a {{tag}} -m "{{commit message}}"
// set HEAD back to whatever you want it to be
git checkout master
git push --tags
git tag --delete {{tag}}
git push --delete origin {{tag}}
http://{{group}}.github.io/{{repo}}/
npm owner add {{name}}