I am used to SVN (SubVersioN) rather than git. I kind of hate git, maybe because its command line is harder for my brain to digest. Hopefully, GitHub supports both git and svn.
If you are like me you would be interested in using SVN with github repositories. In this post we are going to learn how to do just that.
1. In windows, run cmd. In Ubuntu/Linux, start the terminal (Don't ask me how. If you are using linux you're probably smart enough to figure this out yourself!)
2. Now type svn --help and then press enter. If you see usage instructions you have svn installed. Now skip to the next part.
If you don't have SVN installed,
On Windows, install Win32SVN. You may have to restart after installation.
On Ubuntu, run: sudo apt-get install subversion
On other linux distro except Ubuntu/Debian, refer to your package manager documentation to install subversion.
https://github.com/{user name}/{repo name}
Let's say we will be working with:
https://github.com/adnan360/cvstatichtml
1. Now go to the repo link with your browser (go to the above link if you don't have one). You will find an url under the title "HTTPS clone URL". Click Subversion to get an URL for SVN. Copy that url. [The url is usually like: https://github.com/{user name}/{repo name} Although you could use the github page link above but I showed that if you forget which url to use. ]
2. Now open command prompt or terminal. cd to a proper directory.
In Windows, you can use a shortcut to cd to a directory. Just open a directory in explorer, hold down Ctrl+Shift and right click, then select "Open terminal window here".
Don't worry about creating a directory. A directory with the name of the repo will be created.
3. Type svn co followed by a space. Then right click and select paste. Example:
It will take some time to download the repo.
4. Now cd to the repo directory. Example:
(We will need this cd command for executing later commands.)
5. Now run:
The commands above will prepare you to modify the code.
1. Create a branch:
Replace /my_awesome_update to something more personal to you. "Added a new branch" is just a message to identify this change to the repo (that you just made a branch). This will later help you to merge.
The trunk directory contains the downloaded code which is untouched. We copy the untouched code to branches/my_awesome_update. We would edit the code under that directory.
2. Now go to you {repo directory}/branches/my_awesome_update and make your changes.
1. Let's see the file status:
This will say which files were changed.
2. If you see a Question Mark (?) beside some files (in the svn status output), then add these files (or directories) to the repo with:
This is a bit boring sometimes but cool once you've done it.
Now check again with an svn status to see if you got any ? marks still. If you get any, use avn add "xxx" to add them.
3. Send changes:
Replace "My awesome new update" with your own description of the change.
Now you have it! You can submit your code to github! With SVN! How cool is that!
Ref: https://help.github.com/articles/support-for-subversion-clients/
EDIT: SVN URL fixed
If you are like me you would be interested in using SVN with github repositories. In this post we are going to learn how to do just that.
Got Client?
Make sure you have svn client installed. I am comfortable with svn command line. In windows I use Win32SVN which lets me use svn commands directly in the command prompt.1. In windows, run cmd. In Ubuntu/Linux, start the terminal (Don't ask me how. If you are using linux you're probably smart enough to figure this out yourself!)
2. Now type svn --help and then press enter. If you see usage instructions you have svn installed. Now skip to the next part.
If you don't have SVN installed,
On Windows, install Win32SVN. You may have to restart after installation.
On Ubuntu, run: sudo apt-get install subversion
On other linux distro except Ubuntu/Debian, refer to your package manager documentation to install subversion.
How to Checkout (Download files from a repo)
In the world of version control, Checkout is a fancy way of saying download a copy of the current repository (or repo). Each project is kept under a repository. Repo link for its page on github follows this format:https://github.com/{user name}/{repo name}
Let's say we will be working with:
https://github.com/adnan360/cvstatichtml
1. Now go to the repo link with your browser (go to the above link if you don't have one). You will find an url under the title "HTTPS clone URL". Click Subversion to get an URL for SVN. Copy that url. [The url is usually like: https://github.com/{user name}/{repo name} Although you could use the github page link above but I showed that if you forget which url to use. ]
2. Now open command prompt or terminal. cd to a proper directory.
In Windows, you can use a shortcut to cd to a directory. Just open a directory in explorer, hold down Ctrl+Shift and right click, then select "Open terminal window here".
Don't worry about creating a directory. A directory with the name of the repo will be created.
3. Type svn co followed by a space. Then right click and select paste. Example:
# svn co --depth empty https://github.com/adnan360/cvstatichtml
It will take some time to download the repo.
4. Now cd to the repo directory. Example:
# cd cvstatichtml
(We will need this cd command for executing later commands.)
5. Now run:
# svn up trunk # svn up --depth empty branches
The commands above will prepare you to modify the code.
How to modify code
In github, it is extremely recommended that you create a copy of the code in a separate directory then modify it. We copy the whole code in a "branch" then edit it. This way the original code is left untouched and safe from our goofy coding!1. Create a branch:
# svn up trunk # svn copy trunk branches/my_awesome_update # svn commit -m "Added a new branch"
Replace /my_awesome_update to something more personal to you. "Added a new branch" is just a message to identify this change to the repo (that you just made a branch). This will later help you to merge.
The trunk directory contains the downloaded code which is untouched. We copy the untouched code to branches/my_awesome_update. We would edit the code under that directory.
2. Now go to you {repo directory}/branches/my_awesome_update and make your changes.
How to send your code to GitHub (Yaaayy!)
If you've followed previous steps correctly, now its easy to send your update to github.1. Let's see the file status:
# svn status
This will say which files were changed.
2. If you see a Question Mark (?) beside some files (in the svn status output), then add these files (or directories) to the repo with:
# svn add {file or directory}
This is a bit boring sometimes but cool once you've done it.
Now check again with an svn status to see if you got any ? marks still. If you get any, use avn add "xxx" to add them.
3. Send changes:
# svn commit -m "My awesome new update"
Replace "My awesome new update" with your own description of the change.
Now you have it! You can submit your code to github! With SVN! How cool is that!
Ref: https://help.github.com/articles/support-for-subversion-clients/
EDIT: SVN URL fixed
No comments:
Post a Comment