This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| snippets:git [2018/03/09 15:37] – allspark | snippets:git [2022/06/28 10:32] (current) – allspark | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | # git push --force | + | # git |
| + | |||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ## git push --force | ||
| ``` | ``` | ||
| Line 6: | Line 12: | ||
| ``` | ``` | ||
| - | # remove last commit, but keep changes | + | ## remove last commit, but keep changes |
| ``` | ``` | ||
| Line 12: | Line 18: | ||
| ``` | ``` | ||
| - | # tree on console | + | ## tree on console |
| ``` | ``` | ||
| Line 40: | Line 46: | ||
| ``` | ``` | ||
| + | ## ignore changes in tracked file | ||
| + | |||
| + | ``` | ||
| + | git update-index --assume-unchanged file | ||
| + | ``` | ||
| + | |||
| + | To undo and start tracking again: | ||
| + | |||
| + | ``` | ||
| + | git update-index --no-assume-unchanged [< | ||
| + | ``` | ||
| + | |||
| + | ## split directory to new repo | ||
| + | |||
| + | ``` | ||
| + | git filter-branch --prune-empty --subdirectory-filter FOLDER-NAME | ||
| + | ``` | ||
| + | |||
| + | ## show staged diff | ||
| + | |||
| + | ``` | ||
| + | git diff --cached | ||
| + | ``` | ||
| + | |||
| + | ## revert part of a commit | ||
| + | |||
| + | ``` | ||
| + | git revert -n $bad_commit | ||
| + | git reset HEAD . # Unstage the changes | ||
| + | git add --patch . # Add whatever changes you want | ||
| + | git commit | ||
| + | ``` | ||
| + | |||
| + | ## delete remote branch | ||
| + | |||
| + | ``` | ||
| + | git push origin --delete feature/ | ||
| + | ``` | ||