GIT: Unterschied zwischen den Versionen

Aus wiki
Wechseln zu: Navigation, Suche
Zeile 21: Zeile 21:
  
 
Rebase
 
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
+
  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

Version vom 30. Januar 2017, 16:45 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