How to point gitbox/git to different local directory - macos

Hi guys I have a remote repository cloned locally, Because my new changes have saved it to a different directory (workspaces in eclipse) I want to point git to the workspace directory rather than the other directory, how do I do this? Gitbox doesn't seem to have any options, and I can't see the .git folder

In your WORKSPACE do
git init
and then from where you pulled your copy initially. Do
git pull /path/to/your/workspace/project/dir

Related

Copy contents of different branches in github repository to local folder with branch names as folder names

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

local repository not showing and files and folders

I just cloned my repo from my GitHub account but I'm unable to see any files and folders on my local machine except the .git folder. When I run the git pull command, it says Already up to date and when I run git push command then it again says Everything is up-to-date.
I can assure you that my remote repo is not empty. It has many files and folders.
Below is my remote repo screenshot
I can see you have 2 branches, maybe your default branch if not main in this repo.
Try
git checkout "otherbranch"
or
git switch "otherbranch"

How to recover .git folder deletion?

I accidentally deleted my .git folder, I would like to recover the .git folder, but I permanently deleted it.
Will I lose all my project's history?
I also tryed the following solution with no success.
Notes:
It happened when I imported the code to the Eclipse IDE.
I made many local changes without pushing them.
I also using GitHub as a repo.
Using Windows 10.
If you have pushed your changes to GitHub, then all your history is sitting in the repo on GitHub. You can clone the repo again.
If you have not pushed your changes to a remote repo, then the only place that those changes existed is in your local .git directory in your project directory, and those changes are now gone.
I had to re-clone the repository and paste the .git folder in the recently cloned project, into the project's folder.
So I only lost the local commits.

Changed folder structure in Xcode Project not reflected in Git Repository

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>.

uploading code to github

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'.

Resources