dolt icon indicating copy to clipboard operation
dolt copied to clipboard

`dolt checkout` should support a commit + table argument

Open reltuk opened this issue 4 years ago • 3 comments

Example:

$ dolt reset HEAD~

Should set working root value to the root value at HEAD~.

$ dolt checkout HEAD~ -- table_name

Should set table value for table_name in the working and index root values with the table value from HEAD~'s root value.

reltuk avatar Mar 29 '21 06:03 reltuk

I jusft found this one https://github.com/dolthub/dolt/pull/1031, and somehow it wasn't merged or dealt with.

WestXu avatar Mar 29 '21 06:03 WestXu

A bug in the dolt reset --hard <commit> functionality:

dolt sql -q "CREATE TABLE test (pk int PRIMARY KEY);"
dolt add -A && dolt commit -m "made table test"
dolt sql -q "INSERT INTO test VALUES (1);"
dolt add -A && dolt commit -m "inserted 1"
dolt sql -q "INSERT INTO test VALUES (2);"
dolt add -A && dolt commit -m "inserted 2"
dolt branch -v
dolt reset --hard HEAD^
dolt branch -v

Shows:

* master                                        	kl6nmlchia9rlabnjh1j3q8a1gja7vjv

followed by:

* master                                        	g7fj8mc8d1ee7e53vff2qif2c7bkn5cf

whereas, AFAIK, dolt reset --hard should not update the branch ref at all.

reltuk avatar Mar 29 '21 06:03 reltuk

whereas, AFAIK, dolt reset --hard should not update the branch ref at all.

reset --hard HEAD^ definitely moves the branch ref in git.

% git branch -v
* zachmu/test                      1741078f9 added test3
% git reset --hard HEAD^
HEAD is now at d7dda4849 added test2
% git branch -v
* zachmu/test                      d7dda4849 added test2

zachmu avatar Aug 12 '21 18:08 zachmu