Remove File from Repository without deleting local copy - repository

How do I do this in Subclipse:
svn rm --keep-local file

This option is not exposed in Subclipse. So you have to stash the file somewhere and then delete it and commit it and put it back locally.

Related

Using git-secret with git pre-commit not working

When setting up pre-commit hook to call git secret hide in order to encrypt secret files on running commit to commit one or more changed files, the changed files are committed as expected but I am left with two new changed files which are not staged or committed .gitsecret/paths/mapping.cfg and src/tokens.ts.secret with tokens file being my secret file. The secret file appears to be the new encrypted file but issue is that it is not being staged or committed. I am unsure of what my pre-commit file should look like, should it manually add/commit files - I wouldn't think so.
My pre-commit file looks like:
#!/bin/sh
export PATH=/usr/local/bin:$PATH
echo "path $PATH"
git secret hide
Expected result is that these two files are staged and committed together with my commit.
Solution was to add the changed files after call secret hide in pre-commit file. This is what worked for me.
#!/bin/sh
export PATH=/usr/local/bin:$PATH
echo "encrypting files"
git secret hide
git add .gitsecret/paths/mapping.cfg
git add src/*.secret

Git and XCode: Merging .xcodeproj gives binary warning

I am working with branches and wanting to merge with my master, but the files inside of my .xcodeproj are causing huge issues.
Constantly getting errors about overriding them, that they are binary files, etc etc.
What do I need to do to never have to worry about this? It is driving me nuts!
NOTE: I have a .gitignore file in my master that ignores these files, but not in my branch. Not sure what to do about that.
In the root of the project (eg, same directory as .git), add a git ignore file
.gitignore
With a line that says
.xcodeproj
Then remove the .xcodeproj file from the repo...
git rm --cached /path/to/.xcodeproj
Then add the .gitignore file
git add .gitignore
Then commit
git commit -m "Removed .xcodeproj; added ignore pattern to excluded it"
You can use a .gitignore file to specify that file to be ignored by git.

Cannot add SQL file to Git repository?

I need to add a SQL file to my Git repository. For some reason Tower or Git on the command line does not see that I've added a new file whenever it ends in .sql.
I've tried creating an empty .sql and removed everything in .gitignore, but it still doesn't see it.
Any ideas?
You probably have a global gitignore set up. This page on GitHub https://help.github.com/articles/ignoring-files recommends that SQL files are included in a global git ignore.
Follow instruction on that page to set your own global rules.

How do I change ignore-paths on an existing git-svn repo?

I have an already existing git-svn repo with an ignore paths in my .config file that looks like this:
ignore-paths = ^(?!(Path1/Proj1|Path1/Proj2|Path2/Proj3))
This works well.
Someone added a new project in svn that I now need in my git repo.
If I change ignore-paths to what's below and issue a fetch or a rebase, I never see Path2/Proj4
ignore-paths = ^(?!(Path1/Proj1|Path1/Proj2|Path2/Proj3|Path2/Proj4))
In the past, I've always given up and blasted away my git repo and recreated it. Is there a better way?
After editing the ignore-paths you need to
git svn reset -r <n> -p # where <n> is the SVN revision where the new path was added.
git svn fetch
git rebase # or reset
Reference git-svn(1):
reset
Undoes the effects of fetch back to the specified revision.
This allows you to re-fetch an SVN revision. Normally the
contents of an SVN revision should never change and reset
should not be necessary. However, if SVN permissions change,
or if you alter your --ignore-paths option, a fetch may fail
with "not found in commit" (file not previously visible) or
"checksum mismatch" (missed a modification). If the problem
file cannot be ignored forever (with --ignore-paths) the only
way to repair the repo is to use reset.
Only the rev_map and refs/remotes/git-svn are changed (see
$GIT_DIR/svn/*\*/.rev_map.* in the FILES section below for details).
Follow reset with a fetch and then git reset or git rebase to
move local branches onto the new tree.

Is there a way for Bazaar to automatically detect and apply changes made in a working directory?

Is there a way for Bazaar to be able to automatically detect changes (adds, removes, renames, etc.) made to part of the working directory and automatically apply them?
I have a directory tree in my repository which is generated by another process so I can't do all the bzr add, bzr delete, and bzr rename commands as the files are changing. Instead, I would like a way to have bzr notice all the changes and apply them after this process is run.
The only way I can think of doing this right now is running bzr status and then manually (or by writing a script) run bzr add and bzr delete on all the files listed. This will work but I am hoping there is an automated method that could also determine if a file was renamed (an added file has the same contents of a delete file).
You don't need to explicitly mark files as deleted. And bzr can detect renames (either with automv plugin or with builtin functionality):
bzr mv --auto
Note that if you moved the files to a new folder that you just created, you have to version it, but without adding its children (--no-recurse), othervise mv --auto might fail to detect renames:
bzr add --no-recurse newfolder
Then you need to add all files which are not part of renames:
bzr add subdir/
Could you just call bzr add * at the end of the process? Your subsequent commit should take care of all additions and removals. This will not detect if a file was renamed/moved by some process other than bzr mv (and I am unaware of any way to do so).
It looks like the automv plug-in will automatically detect renames and moves. This, along with bzr add * should do the trick.