GIT: Unterschied zwischen den Versionen
Aus wiki
| Zeile 31: | Zeile 31: | ||
it allows you to revert a merge if accidentally happen | it allows you to revert a merge if accidentally happen | ||
| + | |||
| + | Set new remote tracking branch: | ||
| + | git branch --set-upstream-to origin/branchname branchname | ||
Version vom 25. August 2017, 09:29 Uhr
Commands
Delete all remotely deleted files
git rm $(git ls-files --deleted)
View File 2 Commits before
git show HEAD~2:public/app/styles/main.css
Search File in Log
git log --diff-filter=D --summary | grep filename | awk '{print $4; exit}' | xargs git log --all --
Nice Git log
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit src: https://coderwall.com/p/euwpig/a-better-git-log
As git alias command:
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" just use git lg
Set new remote url for git repo:
git remote set-url origin git@github.com:ChristofBuechi/RetrofitExample.git
Rebase
rebase a commit-history to a new base. Means if you have a few commits local, which are based on a commit from a different branch, you can move this stack of commits to another branch or commit. Basically it is a cut and paste of commits on a new base
Merge -no fast forward
Git creates no merge commit if the merge is fast forward. To force git to make a commit: http://stackoverflow.com/questions/2500296/can-i-make-fast-forwarding-be-off-by-default-in-git for all branches in the repo (git config --add merge.ff false) Or git merge -no-ff in every merge it allows you to revert a merge if accidentally happen
Set new remote tracking branch:
git branch --set-upstream-to origin/branchname branchname