Difference between revisions of "Git"

From UVOO Tech Wiki
Jump to navigation Jump to search
Line 21: Line 21:
 
wipe history - you can use git clone as well or just copy files to new repo
 
wipe history - you can use git clone as well or just copy files to new repo
  
# Random commands
+
# Showing Changes
 +
- https://stackoverflow.com/questions/48570464/what-is-the-git-command-used-by-github-pr-to-show-differences
  
 
hosts.txt
 
hosts.txt

Revision as of 11:40, 13 August 2020

Git Common Commands

git reset --soft HEAD~1  # Keep changes

git reset --hard HEAD~1  # Discard changes

ref: https://www.git-tower.com/learn/git/faq/undo-last-commit

git clone git@github.com:jeremybusk/myrepo.git
git checkout --orphan temp_branc
git add -A
git commit -m "add files"
git branch -D master
git branch -m master
git push -f origin master

wipe history - you can use git clone as well or just copy files to new repo

Showing Changes

hosts.txt

host1,up
host2,up

Show new lines

for i in $(git diff master...pr -- hosts.txt | grep "^+" | grep -v "^++" | cut -c2-); do echo add $i; done