Changes

Jump to navigation Jump to search
827 bytes added ,  14:19, 16 August 2017
no edit summary
== Working on a remote terminal ==
 
If you're working on a remote terminal and your repository get's complicated, but you don't have desktop tools like [[meld]] or [[gitk]] to look at it, you can copy the remote repo to your desktop with <code>rsync</code>, even if you have to jump through a bastion host with something like:
<source lang="bash">
rsync -e "ssh -t bastion ssh -A" -ravz centos@10.0.50.68:/opt/meza/ ./meza-es1/
</source>
If that complains about host-key verification, then simply do an SSH first to the host, accept the host key identity, and logout. Now the rsync will work because the host-key is already accepted as valid.
 
== Tracking remote branches ==
 
Checkout a specific branch from origin, and track it.
What if you enter <code>git checkout -b REL1_29</code> when you *should have entered* <code>git checkout -b REL1_29 origin/REL1_29</code>? Just tell git that you meant to track the branch in origin: <code>git branch --set-upstream-to=origin/REL1_29 REL1_29</code>
== Tracing in Status ==
Add <code>GIT_TRACE=1</code> to your command to see more of what's going on. (Note that there are no spaces and no semicolon.)
GIT_TRACE=1 git status
</source>
 
== Just the facts ==
 
Want simple red/green diff lines?
See all the changes in color, but without any context lines, and without the leading +/-/<nowiki>[space]</nowiki>
</source>
== Add that forgotten file ==
You forgot to add a file to the last commit? Just add it to the index, and commit with <code>--amend</code>. Added a file that shouldn't be there? <code>git rm</code> it. If you leave off the -m (message) option in the new commit, it will let you re-use the last commit message. This lets you "undo the last commit" and redo it right. You usually do not want to amend a commit if you've already pushed it to other repos, but if it's just local <code>--amend</code> is awesome-sauce.
# from now on you can just 'git push' from master
</source>
 
== Create a README from a webpage ==
Now create a fine README file using [[pandoc]] to convert your webpage to [[Markdown]]
4,558

edits

Navigation menu