SVN Create Branch from Uncommited Code - visual-studio-2010

I’m new to SVN. I have a project that I’m adding new feature too and it has taken longer than I thought [*surprise not]. Now some production code needs fixing. How can I save my uncommitted “new feature” code as a new Branch?
Thanks!

With the command line tool, go to the root of your working copy and perform the following steps:
First create a new (feature) branch in the repository. The following command has no effect on your working copy:
svn copy ^/hello/trunk ^/hello/branches/feature-foobar
Now move your working copy with all uncommitted changes to the feature branch and commit the changes:
svn switch ^/hello/branches/feature-foobar
svn commit
Move your working copy back to the trunk and start working on the bug fix:
svn switch ^/hello/trunk
Later you go back to the feature branch, complete your changes and reintegrate them with the trunk.

Just create the branch before committing the code, make sure you are on it, then add and commit your changes.

Related

Why commit updates are shown in main folder and not in master branch? Xcode

I just did two commits and they don't show up on master branch, they do in the main project folder, same in Bitbucket repo, it only shows yesterdays commits. I'm not sure how to fix this. If I try to check out to master branch, I get a warning to lighter push or discard changes, but if I push them, they don't appear anywere. I'd appreciate very much a little explanation on how that could have occurred. I'm just starting with version control and I surely messed it up when I checked out on previous commits to check some part of the code, although I thought I did check-out again on last commit.
Many thanks as usual.
I solved it as so:
Selected the latest commit on actual Master branch.
Created a new branch from it and named it anything but Master. That is an exact copy of actual non synchronised Master branch.
Deleted actual Master branch.
Created a new branch from latest commit on newer created branch at point 2 and named it Master.
Deleted branch created at step 2.
Pushed the missing commits to Bitbucket.
Now I have a new Master branch that is in sync with its bucket.
Hope this will help others.

Reverting to a previous version git repo

Hello so I've done this before I just completely forgot how.
What I am trying to do is I have a remote on my github repo and I have an old version that I would like to revert to meaning I can commit from it and it would now be at the top of the repo if that makes sense since my current repo is having some issues and I want to go back to a specific version.
I remeber slightly what I was able to find out last time which worked out beautfully and that was I checked out the version I want and then I created a new remote or split the remote or something, added the version on to the new one and then merged the branches or remotes. It was something along those lines, I just don't remember exaclty and I would appreciate someone guiding me through as I am unable to find the old posts I was previously looking at.
This is a Swift Xcode project
Thank you in advance for all of the help
Instead of rebasing/restting your branch, you could revert the past commits you don't want, in order to create a new commit which would restore the state of the branch to the content of an older commit.
See "Git reset --hard and a remote repository"
git revert HEAD~N
git push
Using terminal git, you can do git rebase -i HEAD~N where N is the number of commits you want to backtrack. Then you can choose to drop or edit commits. In your case, you only need to drop the most recent commits and then you will be effectively back to one of your previous commits. In other cases, this can be used to combine/split commits as well.

xcode refuses to allow switching branches when there are uncommitted changes

I'm using Xcode 9 and in my project I started to work on a completely different feature but unfortunately I've forgotten to create a new branch before doing that. So, now I have a lot of changes which don't refer to an old branch, so I create a new one, but I can't change my current branch without committing them.
Is there some way to change the branch, while having uncommitted changes, or I don't have other choice but to commit them to the current branch?
Don't know Xcode 9, but from the command line, you can use the "git stash" command.
"git stash" allows you to store your changes and re-apply them latter. This way you can store them and remove them from the current branch, switch the branch and then re-apply them on the new branch:
git stash
git checkout new_branch
git stash apply

"git checkout" Doesn't Update Files

my workflow with git is something like this:
1. pull --rebase from origin/master
2. create a new branch for a specific issue and make my changes on that branch
3. switch head back to master and then merge the new branch I've created to to master
from the documentation page, git checkout is suppose to
Updates files in the working tree to match the version in the index or the specified tree
however after I made changes to the new branch and checkout master and check the status using 'git status', the changed files is still present.
Worst of all, I have used the 'undo file changes' option in git extension for visual studio, now that even if I switch back to the branch I created using the 'checkout' command, I no longer see my changes. Is there anyway that I can redo those changes?
Before "checkout master", are you sure you are committing the files in the branch you are working on?
Make sure you commit the files in the branch you are working on. Otherwise, if git discards the changed files, you'll have lost them for ever.
If you do not want to commit the files yet, try looking at git stash. Git stash allows you to temporarily save your changes, without committing them to any branch.

What's the difference between Commit and Update?

I am new to version control, and am not sure of the differences between using Commit vs Update when using ankhsvn.
What's the difference between a commit and update? When should I use one verses the other?
Commit puts your changes into the repository.
Update gets the latest version from the repository.
Update gets the latest from the repository onto your workspace.
Commit commits or checks in your changes into the repository.
Best practice is to do an Update first to get the latest so that you can merge the changes and resolve any conflicts with the code on your workspace.
You will be forced to do an update if there are changes in the repository when committing but its quicker to do it before trying to commit.
Commit = Commit/confirm your changes to the repository.
Update = Get the latest version/changes from the repository.
When you change a file and want to keep the changes, commit them to the repository.
When you want to get the latest available version/s from the repository, use update to update your local files.
I hope this clear things out for you.
Update is called "Get latest" in TFS/Source Safe if I remember correct...
/Fred
A commit will upload your changed files to the repository and create a revision. Whereas an update will download any revisions from the repository into your local copy.
Commit uploads your changes on the CVS / SVN server, and Update overwrites the files on your localhost with the ones on the server.
This is very very basic SVN stuff. Read the SVN book, or at least the chapter about fundamental concepts and basic usage.
Update means: "take all the new stuff in the repository and apply them in my working copy".
Commit means: "take all the changes I've made in my working copy and apply them in the repository"

Resources