What's the difference between Commit and Update? - visual-studio-2010

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"

Related

How to ignore an incoming commit

I want to have two separate versions of a file: One on github and one on my local machine.
More specifically, how do I ignore a commit coming from the remote server. In this particular case, I modified the file on github, committed it, but I want it to not change on my local machine.
I put the readme file on .gitignore.
Changed the file on github.
Made a commit
Fetched the commit on my local machine using VS2017.
How do I "ignore" the commit. And keep the two versions separate.
You can at least try:
git update-index --skip-worktree -- README.md
As I mentioned here, that would resist a git pull.
And you would keep a local version of README.md, different from the tracked one from GitHub.
I don't presume to know if it is a good idea or not, in your particular situation.

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.

How do I make my local files become the latest changes in tfs?

After getting a specific version of the project and making some changes, I want to commit these changes and ensure that no files change and my local copy becomes the latest version that people can pull.
Oops. Looks like something similar was asked here:
How to get specific changeset version treated as changes relative to latest version?
Update
It's not able to do this , when you commit your local changes, TFS will automatically compare yours local changes with "the latest" version on sever, it will not pick up the specific version, you have to solve the conflicts manually. Unless you directly roll back your changeset to the specific version you got.
Another workaround, just like jesse mentioned in above link, you could use shelveset to temporarily store the specific version code and get latest on your local workspace, resolve the conflicts locally first. Then you don't have to solve it when you do the commit.
To sum up, there are changes between the specific version/changeset with "the latest", you have to resolve the conflicts, either when you pull files down to workspace or commit back to server. Unless you commit your changes to server, other people could be able to pull your version.
Generally you just need to check in/commit these changes to remote TFS repository, but you may need to resolve the conflicts (conflicts between your local version and the current latest version) during the check in. Just keep the local version When resolve the conflicts. See Resolve Team Foundation Version Control conflicts for details.
Another workaround is creating a new branch, then check in/commit your local version to the new branch. Thus it becomes the latest versiont on the specific new branch. And team members can get latest from this new branch.

SVN Create Branch from Uncommited Code

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.

How do I update the /app folder when Laravel is updated?

Sometimes I have problems with my Laravel project after running composer update. I believe this is caused by changes in the Laravel application skeleton (https://github.com/laravel/laravel). How do I update my local project to reflect those changes?
From the awesome forum post on the Laravel forums by Kindari (http://forums.laravel.io/viewtopic.php?id=5367):
If you originally cloned this repository and still share a git history
with it, you can usually merge in changes easily. Assuming your remote
is 'upstream' pointed at this repository, you can do the following:
git fetch upstream
git merge upstream/develop
Alternatively you could cherry pick in individual commits
from the develop branch, but I won't cover that here.
If you downloaded the zip distribution originally or
removed the upstream history, you can still resolve your problem
manually. Look at the commits on this branch and make any changes not
present in your application. Usually the breaking changes are simple
configuration changes.
Since most of the changes are likely to be simple configuration changes,
another option is to do a diff on the root folder and the /app folder. You'll mostly see your own configuration, but you'll also see any new configuration items that you should add.
I usually use git pull request. A git pull request does a git fetch followed by a git merge. It works for me nicely. In other words, A git pull is what you would do to bring your repository up to date with a remote repository.

Resources