Useful SVN and Git commands – Cheatsheet

Posted by Madhan ayyasamy on Mad Han RoR Tips See other posts from Mad Han RoR Tips or by Madhan ayyasamy
Published on 2010-11-30T02:51:00.000-08:00 Indexed on 2010/12/06 16:59 UTC
Read the original article Hit count: 490

The following snippets will helpful one who user version control systems like Git and SVN.

svn checkout/co checkout-url – used to pull an SVN tree from the server.

svn update/up – Used to update the local copy with the changes made in the repository.

svn commit/ci – m “message” filename – Used to commit the changes in a file to repository with a message.

svn diff filename – shows up the differences between your current file and what’s there now in the repository.

svn revert filename – To overwrite local file with the one in the repository.

svn add filename – For adding a file into repository, you should commit your changes then only it will reflect in repository.

svn delete filename – For deleting a file from repository, you should commit your changes then only it will reflect in repository.

svn move source destination – moves a file from one directory to another or renames a file. It will effect your local copy immediately as well as on the repository after committing.
git config – Sets configuration values for your user name, email, file formats and more.

git init – Initializes a git repository – creates the initial ‘.git’ directory in a new or in an existing project.

git clone – Makes a Git repository copy from a remote source. Also adds the original location as a remote so you can fetch from it again and push to it if you have permissions.

git add – Adds files changes in your working directory to your index.

git rm – Removes files from your index and your working directory so they will not be tracked.

git commit – Takes all of the changes written in the index, creates a new commit object pointing to it and sets the branch to point to that new commit.

git status – Shows you the status of files in the index versus the working directory.

git branch – Lists existing branches, including remote branches if ‘-a’ is provided. Creates a new branch if a branch name is provided.

git checkout – Checks out a different branch – switches branches by updating the index, working tree, and HEAD to reflect the chosen branch.

git merge – Merges one or more branches into your current branch and automatically creates a new commit if there are no conflicts.

git reset – Resets your index and working directory to the state of your last commit.

git tag – Tags a specific commit with a simple, human readable handle that never moves.

git pull – Fetches the files from the remote repository and merges it with your local one.

git push – Pushes all the modified local objects to the remote repository and advances its branches.

git remote – Shows all the remote versions of your repository.

git log – Shows a listing of commits on a branch including the corresponding details.

git show – Shows information about a git object.

git diff – Generates patch files or statistics of differences between paths or files in your git repository, or your index or your working directory.

gitk – Graphical Tcl/Tk based interface to a local Git repository.

© Mad Han RoR Tips or respective owner

Related posts about Version Control cheat she