Friday, November 8, 2019

How to list all changed files between two branches that does not have common ancestor

If tree is like this:

Same tree you can see by(if you do not have gitk): git log --all --graph

to get a all files:
$ (git diff --name-status master...staging && \
    git diff --name-status $(git merge-base  master staging) fb-4) \
  | cut -f 2 | sort | uniq
2-2.txt
2.txt
3.txt
4.txt


Good picture that explain difference between "..." and ".." - https://stackoverflow.com/a/46345364

Tuesday, November 5, 2019

How to keep release branch commits in history but do not keep branch

Command: git merge --no-ff -s "ours" release-branch 
Removal of branch label from git tree: git branch -D release-branch

It will make "diamond" in git history BUT it will not merge any changes from release branch to master. Blue dots are former "release-branch"