Git notes: Difference between revisions

From I Will Fear No Evil
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 13: Line 13:
<pre>
<pre>
git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
</pre>
Show git commit hashes for each branch
<pre>
git for-each-ref --sort=-committerdate refs/heads/
</pre>
</pre>


[[Category:Git]]
[[Category:Git]]

Revision as of 11:27, 30 March 2023

General git commands that are useful

Change git remote:

With or without ssh keys added to your user account..

git remote set-url origin git@gitlab01.iwillfearnoevil.com:monitoring/nmsui.git
or:
git remote set-url origin https://gitlab01.iwillfearnoevil.com/monitoring/nmsui.git

Sort git branches by last commit

git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'

Show git commit hashes for each branch

git for-each-ref --sort=-committerdate refs/heads/