I know how to ignore files on pushing to GitHub, but how can I ignore all .php files on pulling? Our GitHub is pulled to several locations, but at one of the locations we can't allow any php files (for security measures).
I've read alot, but can't figure this out.
It is not possible to make a selective pull using Git. The easyest way to achieve this is using branchs.
Branch1: This branch will contain all files that are not php files
Branch2: This branch will contain only php files
Then, on the location that can't allow php files, make the pull only from Branch1. On the other locations, make the pull from Branch1 and Branch2 and it will merge automatically.
I hope this helps you.
Related
I've been working on a project, and for no reason, after a merge, our Github got split into two folders - Exeplore and ExePlore. The peculiar thing is that it's only split into these two folders on github.com. If you download the repo, it's correctly organised into one folder. You can push and pull from it, and only get the Exeplore folder, which is fine, no files are lost, but the only issue now is trying to set up continuous deployment on google cloud run. It only downloads one file from the github, causing errors. If anyone knows how to reformat the folders into one, it would be much appreciated.
It seems that the folders are randomly assigned into one folder or the other, as half our HTML has been put into Exeplore and the other half ExePlore, and with other files scattered about.
Here's the link to the repo
Any advice would be much appreciated!
Thanks,
Jenni
Once you fix this problem, it might return. This is a character case problem. Windows ignores case in paths, Linux does not. Check how the git clients are setup. Example: one system might be configured to ignore case and another respects case:
git config core.ignorecase false
git config - corse.ignoreCase
Then you will need to move each file with the wrong case. This git client must be configured to not ignore case.
git mv ExePlore/file1 Exeplore
git mv
I have a repository for a website and it has two separate remotes. One is for the website files and one for datasets and R scripts to make some data in my blog posts reproducible and archived for the future.
My local file structure looks like this.
-Website
|
|--website-files/posts/blog-post1
|/blog-post2
|r_script.R
The folder Website has two remotes one - origin - for the website, and one - blog-post - for the dumping ground for my replication files.
So, because I have cleanly added a second remote, I tried to add the file r_script.R and push it to the remote blog-post.
git add website-files/posts/r_script.R
Then, though, when I check the status, git status shows the file name as untracked listed as
../../r_script.R
The precise question: How do I add a file in a subfolder to be tracked and then to push its own unique remote? Note, when I copy r_script.R to the folder Website, and run git add r_script.R it shows up as a staged file ready for committing.
But I would really rather keep it in the subfolder to keep it clean.
Maybe should I add the repo blog-post as a submodule to the subfolder website-files/posts/ or something like that?
I was performing commits with minor changes in my code and did a lot of them. At the end when I see my github account couple of files are redundant with same name but with a tilde character at the end.
Example : There are 2 files index.html and index.html~
If I pull the latest version to my local repository to remove them, I don't see the files with (~) at the end. I however did some edits directly on the github web portal. Is it because of that?
I didn't create multiple branches as well, but was working on the master branch.
I would like to know why there are redundant files and how to get rid of them from my github.
You probably did
git add .
You may not have '.gitignore' file too.
The ~ files are created by your text editor when you are editing your file.
Just create a .gitignore file and add this to the file
~
Then commit the gitignore file too.
In the future, avoid using
git add .
I'm using git as a VCS and I got several commits in a project. I'd like to upload every change made after a specific commit that is not the latest. Currently, if I want to do this, I have to upload practically every file in my project, or manually search for the modified files after a certain date. Both options are kinda tedious.
Is there an option that helps finding the modified files from a certain commit? Or possibly a combination of searching and selecting the files modified in a given range?
Use git log -n 1 --name-only <revision> to get files modified within a specific revision, or git diff --name-only <revision_1> <revision_2> for files that were changed between two particular revisions.
I need to delete my "uploads" folder from the repository with all its history because it contains only junk testing data.
Please help.
You'll want to use the convert extension that ships with mercurial. Since you want to scrub a directory from the history you'll have to completely filter you're existing repository, CONVERTing it into a new one.
Assume the following made up structure of your repo:
/
src
doc
images
upload
Create a simple text file with the following content
exclude upload
You can do more with this file but keep it simple to get to your goal. The path to be excluded is relative to the repository root
Now run mercurial convert
hg convert --filemap path/to/the/textfile old-repo new-repo
Change to the directory of the new repo. Notice that mercurial created a bare/null rev repo (no content but the .hg directory). Run the following to update to your latest changset. Notice the upload directory is gone!
cd path/to/new/repo
hg update
WARNING: I do not know how this handles named branches or tags. You're on your own. At least you're not modifying the original repo. Make as many copies as you need to get it right.