Skip to content

Instantly share code, notes, and snippets.

@chrisliuqq
Last active December 9, 2016 03:59
Show Gist options
  • Select an option

  • Save chrisliuqq/f892659c6f0096b8dd145928ef200964 to your computer and use it in GitHub Desktop.

Select an option

Save chrisliuqq/f892659c6f0096b8dd145928ef200964 to your computer and use it in GitHub Desktop.
git 操作的備忘

取得 git 上昨天開始與現在的所有修改

git diff $(git rev-list -n1 --before="1 day ago" master)

從所有 commit 中刪除特定檔案

remove a file from a git repository with:

git filter-branch --tree-filter 'rm  file'

remove a folder from a git repository with:

git filter-branch --tree-filter 'rm -rf directory'

This removes the directory or file from all the commits

you can specify a commit by using:

git filter-branch --tree-filter 'rm -rf directory' HEAD

Or an range

git filter-branch --tree-filter 'rm -rf vendor/gems' t49dse..HEAD

To push everything to remote, you can do:

git push origin master --force

git fork rebase

[下午 03:21:33] Ash Wu: 我簡單講
[下午 03:21:42] Ash Wu: 你還是要學一下啊XD
[下午 03:21:51] Ash Wu: 1. git remote add 我的官方 repo
[下午 03:22:00] Ash Wu: 2. git fetch 下來 我的 官方 master
[下午 03:22:08] Ash Wu: 3. 用你的 branch rebase 我的官方 master
[下午 03:22:18] Ash Wu: 4. push 5.pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment