Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
git [2013/08/12 08:51]
127.0.0.1 external edit
git [2021/01/25 21:41] (current)
steve
Line 1: Line 1:
 ====== git ====== ====== git ======
  
-git is full of win.+  * [[https://​stackoverflow.com/​questions/​3319479/​can-i-git-commit-a-file-and-ignore-its-content-changes|git commit a file and ignore changes]]
  
 == Get hash tag of last commit == == Get hash tag of last commit ==
Line 19: Line 19:
 pager = less -E pager = less -E
 </​file>​ </​file>​
 +
 +Here are some useful commands:
 +
 +<code bash>
 +# initialize working copy
 +git init
 +
 +# initialize bare repo
 +git init --bare
 +
 +# reset working copy
 +git reset --hard
 +
 +# show who is responsible for changes
 +git blame
 +
 +# add remote
 +git remote add origin user@blah/​~/​foo/​bar/​
 +
 +# remove remote
 +git remote rm origin
 +
 +# show all remotes
 +git remote show
 +
 +# show details of specific remote
 +git remote show origin
 +
 +# pull any changes down from the bare
 +git pull origin master
 +
 +# make a new branch and start working in it
 +git checkout -b some_updates
 +
 +# make a working copy of existing repo
 +git clone user@blah/​~/​foo/​bar/​
 +
 +# get the status of current branch
 +git status
 +
 +# delete branch locally
 +git branch -D newfeature
 +
 +# delete branch on origin
 +git push origin :newfeature
 +</​code>​