Thread (1 message) 1 message, 1 author, 2016-06-15

Re: several quick questions

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:19

Carl Worth [off-list ref] writes:
2) Ensure that bogus-branch exists somewhere (don't care where), then
   move it:

	# Create the branch (if it doesn't exist)
	git checkout -b bogus-branch >& /dev/null
	# Switch to it (which doesn't happen above if it already existed)
	git checkout bogus-branch
	# Move the branch to the revision of interest
	git reset --hard <revision>
For moving around in history (like cg-seek if I understand
correctly), the above is the right and probably most efficient
way to do with the core-git tools.

	# setup
	$ git branch -f temp ;# make sure it exists
        $ git checkout temp ;# and switch to it
	# repeatedly...
        $ git reset --hard <revision1>
        # do interesting things
        $ git reset --hard <revision2>
        # do interesting things
        $ git reset --hard <revision3>
        # ...
        $ git reset --hard <revisionn>
        # do interesting things
        # once you are done
        $ git checkout master
        $ git branch -D temp
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help