I'm new to using GitHub and I read up a few of the solutions on stack overflow but I couldn't understand them.
I pushed a folder in one of my repository and it shows up as a gray submodule. I need it to be a regular directory inside my repo. Can someone simplify what I need to do or show steps because I don't know how to deal with submodules or .gitmodules or where to find them
Thanks in advance!
If you don't see a .gitmodule at the root of your main repository, that means your subfolder is a nested git repo, recorded as a gitlink (a SHA1 reference), which is what you see as a grayed folder.
All you need to do is:
delete the .git subfolder you should find in that folder
go back to the main repo (one folder up)
add, commit and push: that should push the folder content instead of a tree SHA1 reference.
Related
I have a github repository I wish to copy to my local folder.
This github repository has multiple branches- main, 01_01, 01_02, 02_01, etc...
I wish to download the current contents of each branch in my local machine.
The download happens such that branch main gets downloaded to folder main, branch 01_01 gets downloaded to folder 01_01 and so on.
I'm aware that a git clone copies all branches but then I will have to checkout and see the contents which I do not wish to do.
I would sincerely appreciate if someone one could guide me as to how to do this - may be a bash or powershell script .
Thanks
In the git-windows-interface when I drag and drop a repository it says: "Can't drop folder, You can only drop one folder without git repository with the app at this time. Dropping a single folder will allow you create a new Git repository in that location...".
How should I add a git repository to the git-windows-interface?
thanks
You can try and make GitHub for Windows detect your repo, by modifying the local path(s) it scans.
That would avoid trying that "drag and drop feature" which might not work in your case (being a submodule, which is by nature a nested git repo).
If it isn't possible to change that path, at least try and copy that repo in %HOME%\My Documents (HOME being set by the portable git within GitHub for Windows, C:\User\login on W7+, C:\Document and Settings\Login on WXp).
Then a local scan will detect it.
I was getting the same error. I had been trying to drag in the hidden .Git folder. Instead, drag in the folder above, which contains the .Git folder.
This worked for me:
Rename the ".git" folder to ".git_back"
Create a new git repo in the same folder so the new ".git" folder is in the same folder as the old one.
Close github for windows, delete the new .git folder and rename the old one back to ".git"
Open github for windows again, and it will see the old ".git" folder.
I have an Xcode project that is under version control. I've grouped the classes in the project navigator into folders based on what the classes do (eg. Models, Views, Controllers, etc.). However, these folder structures seem local to my machine and it is not reflected in my own local git repository, or if I do a git pull from another machine, the folders that I've created or organized my classes into don't appear. So, How do you get the changes you make (organizing the classes into folders) to reflect in your local and remote repository?
Try this
# modified, new and deleted files
git add -A
ref
I found that the adding a folder or directory manually inside the local repository to work for me. Create the folder in the repository,git add folder_name/ to actually track and add it to the repo. The files then can be moved into this folder. Depending on how you move it, you may need to do git rm <file_name> and git add </folder_name/file_name>.
I have created a repository named appengine-testers on github. It is a public repository. Though I easily managed to create a repository but I do not know how to store code there. Do I need to upload the code/folder ?
There are multiple options to do that, i'll just briefly tell the simple one.
git clone ssh-path-to-project
It creates .git folder in the project which is used for references.
cd project
copy the entire project code from any location and paste it in this folder.
Now
Add all the untracked files.
git add .
git commit -am <"commit message">
or
git commit -a
Which automatically takes the changes.Lastly
git push
It pushed the entire code to the repository
One more simple option is do
git init
in the project folder and then change the remote url in the .git folder created inside the project folder
Once you create the repo on github, it'll give you a URL (that looks kinda like git#github.com:yourusername/appengine-testers.git) with push access. From there, you just push from your local repo to that URL.
It's probably easier if you add that URL as a remote. Typically you'd call it 'origin'.
So I have a project that is a git repo which contains another git repository. So the structure is this:
/gitProject
/other
/stuff
/anotherGitProject
Currently, I've got anotherGitProject set up as a submodule of gitProject. My problem is that I have to deploy anotherGitProject to another part of my hard drive. Since anotherGitProject functions as an add-on, I just copy the contents of anotherGitProject directly into the other project's directory tree:
/gitProject
/other
/stuff
/anotherGitProject
/otherProject
/(contents of anotherGitProject+otherProject)
My question is: How can I keep track of the changes I make to anotherGitProject within gitProject? This seems really convoluted, but I need to make changes to anotherGitProject on top of otherProject or else this wouldn't be an issue.
The idea would be to:
clone anotherGitProject in otherProject,
or even as otherProject (if the content of anotherGitProject needs to be directly within otherProject, in which case:
rename otherProject in otherProject.tmp
clone anotherGitProject as otherProject
copy the rest of otherProject.tmp content in otherProject
add a .gitignore to ignore anything which isn't anotherGitProject original content
add to anotherGitProject initial repo (the one being a submodule to gitProject) a remote pointing to otherProject
That way, you can fetch/pull from otherProjectdirectly back in anotherGitProject
If anotherGitProject is, as a plugin, a simple subdirectory of otherProject, the process is much simpler, since, as I mention in my first point, you can simply clone anotherGitProject directly in the destination (within otherProject).
The remote step is the same:
cd /gitProject/anotherGitProject
git add remote anotherGitProjectDeployed /path/to/otherProject/anotherGitProject