repo sync options for specific .repo folder - repo

I already repo init from AOSP on and .repo on
ls /tmp/AOSP/.repo
Then I want to have another copy without repo sync from network again.
cd /tmp/AOSP2/;repo sync --local-only <option .repo> /tmp/AOSP/.repo

Related

How to connect two separate folders into the same GitHub repository?

I have already made a GitHub repository with a folder1, but I have a ../etc/etc/folder2 that I would like to add into the same repository because they both are a part of the same project.
As you can see these two folders are not super close to each other, but they are in the same linux file system. How can I add folder2 to my existing GitHub repository that contains folder1?
What I ended up doing was creating the repository in the root directory.
I created a .gitignore file to ignore all files except the two folders that I wanted in the repository.
## Ignore everything...
*
## Except...
folder1
folder1/*
path/to/folder2
path/to/folder2/*
You would need to, locally on your Linux machine, move or copy the folder2 in your local cloned repository, add and commit.
Then you can push, in order to see folder2 in your remote GitHub repository.
The alternative is:
make a Git repository in ../etc/etc/folder2, push it to a separate GitHub repo folder2
reference the remote GitHub repository folder2 as a submodule in your first local cloned repository
That is:
cd /path/to/folder1
git submodule add -b main -- https://github.com/<me>/folder2
That way, you have the repo folder2 referenced by your main repository.
If you change anything in folder2 (original path), add, commit and push.
Then, from the first local cloned repository, git submodule update --remote is enough to update the folder2 submodule content.

How to ignore files folder after committed to git for drupal 8 server?

I am in a situation where files have been committed to git. While doing git status -s files folder changes are showing. I have tried updating gitignore but it’s not working.
I cannot delete the files folder and then update gitignore file with sites/*/files because I have a running application.
add <File/Dir> in .gitignore
2)git rm -r --cached <File/Dir>
The command will remove it from git repository only and as it is part of gitignore, the removed directory or file will not be pushed to remote repo. Any further changes to dir will remain untracked.

git-repo (aosp repo) tool checking-out projects again from local cache

We use the google git-repo tool (aosp repo) to manage a workspace of many git repositories. However, if you want to do a clean checkout that is exactly the same as the last workspace, using the command repo sync will pull in all the changes from remotes first.
How can you get the local repositories populated from only the local cache that is currently in the .repo/ directory?
You can use:
repo sync --local-only
From repo help:
$ repo help sync
[...]
-l, --local-only only update working tree, don't fetch

Git tracking to wrong local directory

I created a new directory 438-healthme and cloned a repo into it.
When I index into that directory on the master branch and run a git status it lists all of my computer's files as untracked (see screenshot).
It seems like I set up git wrong a few years ago--is there a way to fix this?
You must have run git init in a folder. You need to find it and run rm -r .git.
Try again, removing that folder, and recreating it with:
git clone https://url/remote/repo 438-healthme
Then, in 438-healthme, there should be a .git subfolder, which means a git status (in the newly created 438-healthme folder) will show you files only from 438-healthme.

Moving git repo from public_html/stage folder to root public_html/

On my linux server I have a website running in public_html/stage which i cloned from guthub to /stage folder.
Now after the development is over i want to move this folder to root i.e public_html folder, making sure that its sync with my repo.
I tried to cp all /stage files to the root directory but the main folder /app was not copied.
Pls guide me how can I move this staging to production.
Also please let me know what is the standard way of doing this?
They're just files, you can copy them.
cd /path/to/public_html
cp -r stage/* .
Make sure not to copy your Git repository, the .git directory. If you did, that would turn public_html/ into a Git repository.
If you do want to move the whole repository into public_html, again it's just files. Everything git needs is in stage/.git/.
I got the solution to my problem, but not sure if what I did is a standard way. But anyhow it resolved my problem. So here is what i did...
I initialized an empty repo in public_html folder and then added remote to my github repo and finally fetch all code from the repo.
$ git init
$ git remote add origin https://github.com/user/repo.git
$ git fetch --all
$ git reset --hard origin/master
So now my project is working fine at the root of the website and is in sync with the repo. So everytime I do some local changes to my repo I only need to pull them from repo
$ git pull origin master
And thats all!

Resources