Apr 28, 2011

Helpful git-svn cheatsheet

git

In my previous post “A successful git-svn workflow“, I wrote about starting out with git-svn.  This post is a followup with notes on more advanced topics.

Git SVN Branching

First Find the revision that you want to branch from:
git svn find-rev r7654

Check it out:
git checkout b0ec4f9bef566

Then actually create the branch in SVN:
git svn branch <branchName>

you should be able to see a new branch in
https://<your svn repo URL>/branches/

Cherry picking changes

Checkout the remote branch:
git checkout remotes/release-1.2.1

Create a local branch tracking with that remote:
git checkout -b release-1.2.1

Cherry pick your changes:
git cherry-pick 91721c344e3
git cherry-pick fabbed1

then commit it
git svn dcomit

Create a new Git Branch

from http://djwonk.com/blog/2009/04/18/tracking-remote-git-branches/

Push your local branch upstream:

“In my opinion, Mark Eli Kalderon’s post explains the simplest and most elegant approach. Here is his approach, slightly adapted:

  • $ git checkout -b zzz
  • # Let the hacking commence…
  • $ git push origin zzz
  • $ git checkout master # see note 2
  • $ git branch -f zzz origin/zzz
  • $ git checkout zzz
  • # Let the hacking continue…

The key to this approach is using the “-f” flag with “git branch” to force the re-creation of the local branch. It is short and easy to remember.”
Then to track an existing upstream branch:

  • $ git branch –track zzz origin/zzz

About the Author

Object Partners profile.
Leave a Reply

Your email address will not be published. Required fields are marked *

Related Blog Posts
Structuring SwiftUI Previews for API Calls
SwiftUI, together with Combine and Xcode 11+, provide a powerful toolset for quickly creating an app with a native UI. In Xcode 11+, the preview pane was introduced in order to provide live snapshots of […]
Seamlessly Integrating Micro Apps with iFrame
A recent client wanted to upgrade a small portion of their legacy application with a more modern UI and extra functionality, like fuzzy text search. There are a few approaches to incremental upgrades of legacy […]
Consul on Docker EE
[markdown]”Consul is a service networking solution to connect and secure services across any runtime platform and public or private cloud” – [https://consul.io](https://consul.io) This post details a way to run a Consul cluster on Docker EE […]
Passing the AWS Machine Learning Speciality Exam
The Amazon Machine Learning Specialty Exam is a 3-hour, 65 question test. It is designed to test your skills in AWS specific Data Engineering and Machine Learning Practices along with Machine Learning in general. I […]