How do you clone submodules when using gcloud?
This does not work(note --recursive):
gcloud source repos clone <REP_NAME> --recursive --project=<PROJECT_NAME>
Also tried this, after cloning with this:
git fetch --recurse-submodules
And this:
git submodule init
git submodule update
gcloud source repos clone command is a small wrapper around git, but it does not pass through all clone flags to git. If you run it with --dry-run flag
gcloud source repos clone <REP_NAME> --project=<PROJECT_NAME> --dry-run
it will print git clone command it uses under the hood. You can then run this command directly with --recurse-submodules flag (--recursive has been deprecated as of git 2.13).
Alternatively you can run gcloud clone and then use git
git submodule update --init --recursive
Related
I'm trying to clone a specific branch (the "dev" branch) of a GitHub repository. With the git command I can run something like
git clone --branch dev https://github.com/user/repo
What's the equivalent of this in gh (GitHub CLI)? I can't find it in the docs
You can try this:
git clone link_repo -b branch_name --single-branch
In your case, we use cmd:
git clone https://github.com/user/repo -b dev --single-branch
Try the following command to clone a specific branch.
git clone --single-branch --branch <branch-name> <url>
Example:
git clone --single-branch --branch dev https://github.com/test-repo.git
where, dev is the branch name.
https://github.com/test-repo.git is the url.
Please I would appreciate if anyone can drop a direct link to the termux commands used to create repos,commit code and delete them on GitHub through termux terminal,all I have seen through numerous Google searches are only how to install them,I also don't know how to navigate to a certain file or directory.
First of all you have to install git in termux pkg install git . then go to the directory where your code have with cd <name of your directory>
If you want to create a git repository use git init.
then add the files to git
git add <file name> OR add all files in the directory git add .
First commit after installing git you have to specify who you are
git config --global user.name "<Your Name>"
git config --global user.email "<your_email#whatever.com>"
then commit the code with
git commit -m "<commit message>"
commit message is what changes you done in this commit
you have to create a reposityory in github github.com/new
and add github reposityory url to git git remote add origin https://github.com/<github username>/<github repository name>.git
then push the repository to github. git push -u origin master
-u means seting upstream as default. after that just git push
have some reference of tutorials about git
learnxinyminutes, githowto
We have a GitHub repository. After I clone that repository I have to do a git init from command line before any Git commands will work. git pull, git checkout, etc. don't work.
As far as I know, git init initializes a new repository. Is it like after cloning I am creating a new repository again?
Here are the commands I'm trying to run:
git clone <url>
git checkout master
You don't have to do git init in this situation¹. As pointed out in the comments, git clone will give you a local repository that you can start using right away.
The problem is that you're not in your repository when you try to run Git commands. By default, git clone puts the repository in a subdirectory with the same name as the repository that was cloned. You must change into that directory to use it:
git clone git#github.com/foo/bar.git
cd bar
Now that you're in bar/ you can interact with your repository.
¹If you do run git init in the parent directory you're in for a confusing time. You'll end up with a repository in the wrong place and an inner repository containing your code. Git's behaviour with nested repositories often doesn't match users' expectations.
After the clone, get into the projects root directory by `cd your-project" then run git commands
In your case what happened was, you cloned the remote repository then didn't change your present working directory to the cloned project, you were in the parent of the cloned repo, since parent repo itself is not a git repository, git complained, you can't run any git commands
I have been given access to a git repository. I would like to create a new branch to the existing code. I am unable to find proper steps online to do this process. I believe i should first setup the master in git bash and then create a branch. If anyone can give me the sequence of steps to be followed, that would be helpful.
First step is, creating the clone of the remote branch
git clone <git repo> <folder_name>
example:
$ git clone git://git.kernel.org/abc my2.6
change directory to the newly formed directory ie my2.6
$ cd my2.6
Creating a new branch
git branch <branch name>
$ git branch my2.6.14
Go to new branch:
git checkout <branch name>
example:
$ git checkout my2.6.14
The git pro book is a great source to find information and learning about git: http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging.
First make sure you have cloned the git repository using git clone command. After that you can check the current branch with this command: git branch
You can create new branch using this command: git checkout -b mybranch
I'm new to git. I want to use this code:
https://github.com/TouchCode/TouchJSON/tree/feature/ARC
But, when I install it using git on my local machine
$ git submodule add git://github.com/TouchCode/TouchJSON.git
I can only see the master branch
$ git branch
* master
how do I use the feature/ARC branch?
Exactly like it should be:
git clone https://github.com/TouchCode/TouchJSON.git
cd TouchJSON
git checkout feature/ARC
Or
git clone https://github.com/TouchCode/TouchJSON.gib -b feature/ARC
git checkout feature/ARC
Cheers!