I have a directory. It has one file and one directory it in it. The diretory name changes every week or so.
-- Directory
*File-13142 *run.pl
--File-13142
*project1.sh project2.sh project3.sh
How would I move project1.sh project2.sh project3.sh into my subversion control ? ( Path sub/File/File-13142/project1.sh ie). Thank you in advance.
Add it to version control with "svn add" and "svn commit" as normal. Use "svn mv" and "svn commit" instead of just "mv" to rename the directory when it changes names.
If the existing tree is not in a working copy, follow these steps:
Use svn import to add the tree to Subversion repository,
svn checkout one level higher than the added tree (this way you get a working copy),
Perform changes to file contents and commit them to repository using svn commit,
If you need to move / copy / rename delete files or folders in the working copy, use corresponding svn command-line client commands.
Read SVNBook.
Related
I want to version control my R scripts so I've created an R project and a GitHub repo. My scripts are scattered through several directories within the same directory where the R project is.
I would like that my GitHub repository harbors only the scripts, independently of the folders they are locally stored in. However when I run the below command:
git add folder/file.R
git commit -m "my_message"
git push -u origin master
A directory named folder is created containing file.R but I'd like to just see file.R without the folder. Do you know how can I do this? Also, would it be good practice? My local folders are organized so each directory contains its own scripts and results, that's the reason the scripts are separated.
Thank you very much
is there a way to add the file.R without specifying the path?
Not using git add, no. The design constraint for git add is that it should store the file's name exactly as it appears, including the forward slashes, so if the file's name is folder/file.R, that's the file's name.
You have some options here though:
You can make a parallel directory where you put the files with the names you want them to have. Run git init in that directory, copy the folder/file.R file to file.R in that directory. Then cd ../gitdir or whatever is appropriate to get there, and git add file.R.
This method is probably the best because it's the simplest.
You can write your own programs using git hash-file -w and git update-index, which are two of Git's plumbing commands. A plumbing command, in Git, is basically a command that exists so that you can build user-facing commands: they're not meant to be run by humans but rather by other programs. So you write a program (in whatever language you like) that uses these plumbing programs to achieve whatever you want.
In particular, you can create or find a Git blob object holding the contents of file.R as read from anywhere you like, then use git update-index to create an index entry holding whatever path you like and referring to the blob object you created (or found) with git hash-object with the -w flag.
Since Git is a suite of tools, not a solution, you can come up with your own method. The tools in Git are made with particular approaches in mind, but they are flexible enough to be repurposed.
I'm using Sourcetree on OS X. I'm working on a WordPress project. For some reason, changes I make in the 'themes' directory are not being shown as Unstaged files. If I add a test file to /wp-admin/ or /wp-content/ it shows the test file as unstaged. I can't figure out why themes files are not being tracked.
I checked .gitignore and it's empty.
Any help is appreciated. Thanks!
To clarify the question. If SourceTree fails to recognize un-tracked files here are some steps you should take.
Double check that you are not listing the file/directory in .gitignore
Open up a GIT console for that repository and run git status This should show whether any changes are detectable by GIT.
Go to the directory in which you are having problems and look to see if you have any .gitignore files or .git folders. If they exist then deleting them should allow you to add these files to your repository
Caution:
Sometimes having a Repo inside a repo is by design (often referred to as a sub-repository) and could cause issues if removed.
Edit:
I just replicated this scenario with two repos and source tree appeared to see the untracked files once the .git was removed.
Could you open up a terminal window to that themes directory and do an ls -a?
If you use SourceTree, open the terminal and use git add <fileName> -f to force shown any changes in this folder then you can push to Bitbucket
There is file text.jsp in my branch. I want to commit this file into trunk.
I have done check out for trunk folder and i navigated to text.jsp file location in trunk folder.
What is the command to replace. I tried below command
svn replace text.jsp https://mybranch/text.jsp
What is right command in svn command prompt.
The best way is to do it with svn merge command as it will keep the full commit log/history of your text.jsp file in trunk
svn merge --accept theirs-full https://mybranch/text.jsp https://mytrunk/text.jsp
If there are merge conflicts you are forcing to ignore them with --accept theirs-full option as you want to replace the file.
If you don't want to keep the full commit log of text.jsp file in trunk do it like this. (Note that this way the commit log will be started newly)
svn delete https://mytrunk/text.jsp
svn copy https://mybranch/text.jsp https://mytrunk/text.jsp
svn commit
This way you'll avoid unnecessary hassle with branch/trunk checkout, exporting, moving and committing the file manually.
Alternatively you can do it also like this
Navigate to directory where your original text.jsp is (trunk version)
Export the "new" file svn export https://mybranch/text.jsp
As the name of your "new" file is the same as the one in your repository
svn will automatically detect it as a modification. So you just
need to commit it with svn ci text.jsp
As title suggest, I want to know if there is a single git command that put all my project in one folder first (not including .gitignored files) and then proceed archiving the folder— leaving ignored files not included when archiving which is nice.
This can be beneficial for me as I am working on WordPress plugin with multiple release. Some references.
I want all the files (minus the .gitignored files) move to a folder first then proceed archiving that folder
It is possible in one command provided you define an alias but this isn't git-related:
you can:
clone your repo elsewhere (that way you don't get any ignored or private file)
move your files as you see fit in that local clone
archive (tar cpvf yourArchive.tar yourFolder)
But git archive alone won't help you move those files, which is why I would recommend a script with custom bash commands (not git commands).
You don't really need to copy / clone the repo anywhere.
Make sure you committed all your changes.
Process the files any way you want.
Run tar -cvjf dist/archive-name.tbz2 --transform='s,^,archive-name/,' $(git ls-tree --full-tree -r --name-only --full-name HEAD)
run git reset --hard to restore without any of the changes you made in step #2.
Hints:
The --transform='s,^,archive-name/,' is so your files will be extracted toarchive-name/....`, you can remove it if you don't need that.
I know, I should only change files in a project, when the repository is opened. But I now tried to see what happens when I change a file when the repo is closed, because I will often do that, because I'm going to forget to open repos. It's inconvenient ...
Now I see what happens: changes are not recognised. Doing a commit, I get the message "nothing has changed" ... which is not true.
What can I do to make fossil recognise missed changes?
Why did you close the repository? When you do fossil open, fossil will try to deploy the latest version. Maybe it has overwritten your files…
You should use open .... --keep if you don't want to harm your working directory.
As a comparison with git (seems that it's your background):
in git, each working directory has its own .git folder. Multiple working directories for the same repository are typically hardlinked.
in fossil, each working directory contains a file named _FOSSIL_ or maybe .fossil depending on your version. It contains both a pointer to the repository (the object database) plus workingdir-specific data (what you'd call HEAD, stash, uncommitted additions/deletions/renames). close will delete that file. So, in git terms, it's like if you did git clone --bare . some_other_folder.git and then recursive rmdir .git. You still have the project history somewhere, but all information about your working tree is lost.