Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dolt branch --track does not create a new branch #5187

Closed
timsehn opened this issue Jan 23, 2023 · 2 comments · Fixed by #5286
Closed

dolt branch --track does not create a new branch #5187

timsehn opened this issue Jan 23, 2023 · 2 comments · Fixed by #5286
Assignees
Labels
bug Something isn't working cli

Comments

@timsehn
Copy link
Sponsor Contributor

timsehn commented Jan 23, 2023

Repro.

  1. dolt clone dolthub/museum-collections
  2. cd museum-collections
  3. Try to create a branch with dolt branch --track doesn't work.
$ dolt branch -a
* main                                          	
  remotes/origin/json_cols                      	
  remotes/origin/main                           	
$ dolt branch --track origin/json_cols
* main                                          	
$ dolt branch -a                      
* main                                          	
  remotes/origin/json_cols                      	
  remotes/origin/main  

dolt checkout does work:

$ dolt checkout --track origin/json_cols
Switched to branch 'json_cols'
branch 'json_cols' set up to track 'origin/json_cols'.
$ dolt branch -a
* json_cols                                     	
  main                                          	
  remotes/origin/json_cols                      	
  remotes/origin/main 
@timsehn
Copy link
Sponsor Contributor Author

timsehn commented Jan 23, 2023

It looks like --track behavior is different in git branch. You use --track or -u to set the tracking branch of a branch.

But this also doesn't work in dolt:

$ dolt branch json_cols --track origin/json_cols
'json_cols' is not a valid remote ref and a branch 'origin/json_cols' cannot be created from it

This does work in Git:

$ git branch test-track --track origin/Hydrocharged-3d24c03b
branch 'test-track' set up to track 'origin/Hydrocharged-3d24c03b'.

@timsehn timsehn added bug Something isn't working cli labels Jan 23, 2023
@jennifersp
Copy link
Contributor

Workaround for this is to use slightly different formatting of the command for Dolt:

dolt branch --track somebranch origin/mybranch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants