Move files into an existing folder in GitHub - github

I want to move my HTML, CSS, and JavaScript files into the sortable-list folder.
I intended to push the files of my sortable-list project into a folder named sortable-list in my javascript-projects repository. However, when I pushed the files using the cli, it added all the files directly to my zaidazim/javascript-projects repo.
I wish to move the files into the sortable-list folder, so that in the future I can add more project folders here.
How can I achieve that?
P.S.~ I've read some of the previously asked questions but they haven't really helped me much.

If you have that repository cloned locally, simply use git mv
cd /path/to/repo
git mv script.js sortable-list
git commit -m "move file"
git push

Related

How can I stop cloning my application files on GitHub?

I want to stop cloning my application files to Github, How can I do that completely and remove the circle status on each solution files?
Environment: Visual Studio for Mac
Are you intending to have git ignore those files completely?
You can use a gitignore file (.gitignore) in the root working directory of your project to specify which files to ignore. In there, specify a filename per line in that file, or a whole directory to be ignored (eg: Shared/*).
You'll also need to remove those files from your git repo, since they've already been committed.
Copy-pasting from here:
Unstage the file
git reset HEAD newfile
Remove the file from git
git rm --cached newfile
Deleting the file will count as a commit, so you'll need to git push once you're done.
Also note that the file(s) and their contents will still exist in the git commit history, so this isn't a good idea if the goal is removing files with sensitive info.

SourceTree permanent local discard

I am new to Sourcetree and source control in general. I am working on an Android project with a few other people and use bitbucket as the repository. I have learned the basics but don't want to track certain files in my local, specifically a lot of the gradle and iml files. But i think Stop tracking will remove those from the repo. Is there a way to just have source tree ignore any changes i make to certain files locally but not delete them from the repo ?
Thank you in advance
You can create a file and name it .gitignore in the root of the project and in that file place every directory to exclude by git like:
my_folder
my_folder2
The above would be excluded from git tracked files.
If you are already tracking files this command will remove them from index:
git rm -r --cached <folder>

Files and folders added to a cloned repository are not seen in remote repository after pushing

I have a problem with pushing to my remote repository.
What I did is:
1) I cloned an existing repository to my computer
2) I was working for a while at my computer with the project (adding some folders with new data, doing some changes to the existing files)
3)
a) I created my own remote repository on GitHub
b) used git remote set-url origin new.git.url/here
c) used: git add . then git commit -m "Comment" then git push.
The outcome is that in my remote repository I have now only the files that were in the original cloned repository (if I made any changes to them, the changes are there), but no files or folders added by me are there.
When I commit files I added after pushing the repository for the first time, they are seen and commited.
Could you help me to push also all the changes I made to the project before pushing for the first time?
Edit: I think the problem lies in .gitgnore file, but I am not sure which lines I can delete and which not:
*.o
*.a
*.dSYM
*.csv
*.out
*.png
*.so
*.exe
*.dll
*.lib
*.dylib
mnist/
data/
caffe/
grasp/
images/
opencv/
convnet/
decaf/
submission/
cfg/
build/darknet/*
build_*/
!build/darknet/YoloWrapper.cs
.fuse*
*.weights
build/*.cmake
build/*.ninja
build/*.txt
build/*.json
build/CMakeFiles/
build/detect_cuda_compute_capabilities.cu
build/.ninja_deps
build/.ninja_log
build/Makefile
# OS Generated #
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
*.swp
# IDE generated #
.vs/
.vscode/
# Managed by CMake
src/version.h
# Build artifacts
lib/
share/
include/darknet/
uselib
uselib_track
darknet
This is link to the original repository: https://github.com/AlexeyAB/darknet
The right way in your case is to use forks.
So, the first step is to fork remote repository, than you can add changes to it, commit and push to your own fork.
You can't add changes and push it to the original repository if you are not the author of such repo, but you can do it with forks.

Creating new git repository, can't add directory

I am about to throw my laptop through a wall, and am hoping for help before reaching that point. For reference, I am following these instructions exactly - https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/.
I have a directory ".../path/thisdir". Inside of thisdir are (1) a file called Demo.R and (2) a directory called sportVU. sportVU is a directory with ~15 files in it.
When I follow the instructions in that link, my github repo looks like this:
https://github.com/NicholasCanova/packageSportVU
Notice that the sportVU directory link cannot be clicked in github, and when I download the repo, sportVU is an empty folder. Why is this happening? This shouldn't be so tough.
EDIT: this is what the repo looks like in my local machine, I'm 100% sure it's not empty:
It could be that you have two .git folder in your directory. View hidden folders to see.
Similar questions:
What does a grey icon in remote GitHub mean
Why can I not open my folder in GitHub?
Since Git doesn't store empty folders the steps you should follow exactly are:
Delete the old repo and start again following exactly my steps.
git clone <repo url>
Inside the folder of the cloned repo create a directory manually and name it as you want i.e sportVU.
Drag and Drop all the files you want in the sportVU direcrory.
cd to Myrepo/sportVU and type git add *
type git commit -m "added some files"
git push -u origin master.
and you should be all set

Directories of Java class files found in Git repository cloned from BitBucket, but I can't figure out how to remove them

I created a BitBucket repository of several Eclipse projects, and then used Eclipse with EGit to clone that repository to a new Eclipse workspace to check whether I had put all of the files into BitBucket right.
The projects in the new workspace contained *.class files in their bin directories, and I realized that I had neglected to delete those files from the Eclipse project directories in the original workspace before adding the projects to the repository.
However, the BitBucket web page for my repository doesn't display any bin directories in the various Eclipse project directories, and when I try to remove the *.class files from the repository that I cloned, I get an error message that says, for example, "fatal: pathspec 'EclipseProjects/IndexerUtils/build/uw_solr/CmdLineOption.class' did not match any files".
I assume this means that the class files are not being tracked, but I'm not sure. I don't know Git well enough to figure out how to find out whether they are tracked or not. Their presence does not cause "git status" to say that untracked files were found, but if I try to remove any of them, Git says it doesn't know about them. In the meantime, BitBucket doesn't display any of the class files in its repository, but when I clone its repository, all of the class files are included in the new repository that is created.
Is there a Git command that can tell you whether a specific file is being tracked or not? If the *.class files are being tracked, how do I remove them, since apparently "git rm " doesn't work? If they aren't being tracked, why do they show up when I clone my BitBucket repository? What kinds of basic diagnostic commands does Git have that could help me figure out what state my repository is in?
Thanks,
Mike
do you have a case collision; try setting following and see if you can see and remove file using git rm command.
git config --global core.ignorecase true
Please note this "git rm" removes file from that commit onwards. If you want to remove file thoroughly please consider filter-branch
example: git filter-branch --tree-filter 'rm filename' HEAD