Important GIT Techniques
To find the names of all files that were changed(deleted, modified or added) in a given commit
git diff-tree --no-commit-id --name-only -r bd61ad98
To save those files' names to output.txt
git diff-tree --no-commit-id --name-only -r bd61ad98 > output.tx
==========================
Using diff2html-cli for generating preety diff between two commits:
- Install diff2html-cli: Install node first, In command linebrew install node
Then install diff2html-cli, in command line type:
npm install -g diff2html-cli
Run the command to find the diff.html file:
git diff 8f8428f0d da63cef6c | diff2html -i stdin
=============================
Scenario: You have cloned a project from github, you were working locally on it, changed the projects and commited to new local branch(Eg PostMethod). Now you want to also create a remote branch by same name(PostMethod) and push the local changes to that branch.
git branch --set-upstream-to PostMethod origin/PostMethod
Branch 'origin/PostMethod' set up to track local branch 'PostMethod'.
git push --set-upstream origin PostMethod
===============================
Comments
Post a Comment