aws / git-remote-codecommit

An implementation of Git Remote Helper that makes it easier to interact with AWS CodeCommit
Apache License 2.0
271 stars 38 forks source link

how do I specify branch to clone? #8

Open wobeng opened 4 years ago

wobeng commented 4 years ago

how do I specify the branch to clone?

I can usually do git+ssh://mycompany/v1/repos/my-repo@develop

dytoto commented 4 years ago

The git-remote helper should only replace the value of your remote-repo. If you clone with the git-remote-helper, you will still get all of the branches. Assuming you've set up all the git-remote-helper correctly with the right profile you can try the two commands below. To specify the branch you want to checkout after the clone try this command. git clone --branch <branch-name> codecommit://<profile>@<repository-name> To only check out a single branch try this command. git clone --single-branch --branch <branch-name> develop codecommit://<profile>@<repository-name>

tomellis commented 2 years ago

I hit this too, needs a doc update.

Usually you can clone origin/main by not specifying a branch name e.g. git clone codecommit::<region>://<profile>@<repository-name> then run: git fetch --all then see all branches with: git branch -r

This doesn't seem to work with git-remote-codecommit.

Checking out branches directly via the command you mention does seem to work: git clone --branch <branch-name> codecommit://<profile>@<repository-name>