Discussing the nuts and bolts of software development

Thursday, March 29, 2012

 

Surviving the transition between SVN and Git

A guide for the commandline-adverse

As a Microsoft ‘fanboi’ I was at first rather unhappy when the people promoting Git kept insisting that “the command-line is where there power is at” and that “GUIs aren’t good enough”.
They were, in part, right; but there’s a lot you CAN do with the right GUI. I for one am a fan of TortoiseGit (http://code.google.com/p/tortoisegit/)
In this blog post I’ll outline a few common operations that you can do using a combination of Git Bash and Tortoise Git, and a few that are best done in Bash alone (don’t worry, we’ll try to keep the use of Bash to a minimum; Note however that that it will probably be helpful if you were already familiar with basic git concepts (branch, commit, rebase, etc)

Show Log using TortoiseGit

Let’s say you’ve already cloned a remote repository; I’ll use TortoiseGit’s repository as an example, checked out from here http://code.google.com/p/tortoisegit/source/checkout   
The first neat thing you can do with Tortoise is have it show you a nice, easy-to-understand commit graph/history:
Right click your repository and select ‘Git Show log’



Make sure you’ve got “All Branches” checked, so you’re not missing any unrelated branches from your overview.
Now for a short map legend:
- The commit in bold is the commit you currently have checked out. This is the commit you can currently view/compile/modify; any commit you make at this point will be based on the commit shown in bold
- Tags with an orange-ish background, such as origin/master are remote branches: branches that exist(ed) on the repository the last time you did a clone/pull
- There can be at most one tag with a red background, such as master: this is the branch you currently have checked out (earlier I’ve mentioned that you can check out a commit: checking out a branch is essentially the same as checking out its corresponding commit, as far as your working dir is concerned; i.e. you’ll get the same code changes)
- Tags with a green background (not shown in the above pic, since we haven’t created any yet) are local branches. While working with git, branches will be your bread and butter, you’ll be creating a lot of them

Commit using TortoiseGit

To get to the commit screen, just right click on your repository clone, and select Git Commit (note that it will display what branch you’re about do do a commit on, in this case: “master”)


The main difference between command line Git and TortoiseGit is that Tortoise abstracts away the concept of “staging”; basically whatever files have a checked checkbox get staged and committed once you hit OK

Now, let’s look at that graph again and see what happened

As you can see, my commit got added on top of the previously-bold (checked-out) commit.
Also, since I committed my changes against the “master” branch, it also moved up to my new commit.
Now, fortunately this being Git, my changes will not be visible by anyone but myself; no need to worry about Sven being angry at me for messing with those txt files.

Create Branch using TortoiseGit

But wait! I “accidentally” did something wrong! I wanted to keep master and origin/master in-sync, and make my commit on a new branch (that's because we want to use Gerrit, otherwise it would probably have been ok to commit against the master branch). 

So let’s see how to fix this
What we want to do is:
1)      Create a new branch on my new commit
2)      Restore master to its original state
And we will want to do it in that order, since if we were to move master ‘down’ one commit on the graph, my new commit would be left without a branch on or ‘above’ it and Git would delete it, i.e. Git 'deletes' all commits that don’t ‘lead up to’ a branch (actually, commits lost in this way aren't lost forever, it's just a bit complicated to restore them).

Creating a new branch: Right click on your repository, select Create Branch, give the new branch a name you’ll remember and hit OK.


 Let’s check that Log again:

Now that we’ve got a branch to hold our new commit, let’s take the master branch back down to be in-sync with origin/master.

Interactive rebase using Git Bash/Extensions

(AKA: one of your two best friends after doing something silly)

This is the part where we’ll have to use Git Bash, I have yet to find a way to do an equivalent operation using Tortoise. (I know, the white-on-black Bash window tends to repel Windows users, just roll a save vs. Willpower to avoid cringing).
Hint: Git Extensions (http://code.google.com/p/gitextensions/ ) will provide a more Windows-friendly editor for interactive rebasing

Open a git bash window on at your repository, and type in:

git rebase -i HEAD~2

And hit enter.
Now, it could have been HEAD~10 or any other number, depending on how many commits you want to be able to pluck out of your branch.
This is what pops up if you have Git Extensions installed:
Git's interactive rebase (rebase -i) is a very versatile tool, and if you haven't already, I recommend reading more about all the neat things it can do
Do what the nice red font says and you should end up with the following graph:

Master is in-synch with origin/master and our commit is sitting on top of it on our new branch called txtFileChanges

Amending a commit in Tortoise

(the other one of your two best friends after doing something silly)

Let’s say I wanted to change a commit: perhaps I wrote an incorrect commit message, or I left a few files out. Here’s what we need to do:

1) Checkout (Switch to) the commit we want to change
Checking out a branch is straight-forward: right click on it in the Log view and choose Switch/Checkout to “<name>”

2) Amend the Commit
We’re now ready to do amend a commit. Right click the repository folder, select Commit -> “txtFileChanges”; In the commit window, check the “Ammend Last Commit” box.
You can now edit your commit message, add new files to be commited, or remove committed file changes (note: you will lose those changes permanently)



And that’s it for the first part of this guide. The second part will (hopefully) follow soon and contain instructions on how to use Gerrit

Labels: , ,


Comments:
Advices from https://nerdymates.com/blog/capstone-project-ideas will be useful for students in any case. It will help you to get a high grade.
 
Buy the best garden sheds nz online in Newzealand. We provide you quality products at low prices. Treasurebox also provide you home delievery services in Auckland Newzealand.
 
If you are pressured among mono repository or multi-repository or a branch and merge strategy for micro-services - characteristic branches, trunk based development or release branches, then this publish may have something for you. There's nobody right manner, but as with life, to select a higher way, you need to be first self-aware. Similarly to pick out a source control approach to your task, you need to be aware of the analysis procedure, development method, balance of parallel characteristic development with ci and cd, code evaluation and merge manner and issue ownership styles for your teams.

Regards,
Assignment Help Sydney | All Assignment Help
 
Maximum SW developers who have labored for a decade or more would be acquainted with one or the opposite of the centralized model control structures that become widespread at that point. I started out with building a windows consumer for CVS as part of an enterprise project. Read more, Click Here at Write My Essays Cheap by Apex Essays USA.
 
Anda bisa bermain judi dengan santai dan sabar serta tujuan yang tinggi. Dengan cara anda melakukan deposit dan bermain dengan santai agar kemenangan anda akan sangat terjamin
asikqq
http://dewaqqq.club/
http://sumoqq.today/
interqq
pionpoker
bandar ceme terpercaya
freebet tanpa deposit
paito warna
syair sgp
 
The coaching Dissertation Writing Help Service UK document that outlines the approach this is used and the elements impacting upon the accuracy of the results. pure 100% macadamia paste with a mild beige color and delicate flavors. Freshly-cracked, medium-roasted macadamias were finely ground right into a paste.
 
Git is a dispensed VCs; svn is a non-distributed VCs. Git has a centralized server and repository; svn does not have a centralized server or repository. The content material in git is stored as metadata; svn shops documents of content. Git branches are simpler to paintings with than svn branches.

Best Regards,
Cheap Essays Online | Cheapessay247.com

 
Genuinely, switching from subversion to git isn't always very complicated - however only in case, you don't deal with git like a fancier subversion. When you Pay Someone To Write An Essay recognize where the ideas range, the transition becomes smooth.
 
IEEE Project Domain management in software engineering is distinct from traditional project deveopment in that software projects have a unique lifecycle process that requires multiple rounds of testing, updating, and faculty feedback. A IEEE Domain project Final Year Projects for CSE system development life cycle is essentially a phased project model that defines the organizational constraints of a large-scale systems project. The methods used in a IEEE DOmain Project systems development life cycle strategy Project Centers in Chennai For CSE provide clearly defined phases of work to plan, design, test, deploy, and maintain information systems.


This is enough for me. I want to write software that anyone can use, and virtually everyone who has an internet connected device with a screen can use apps written in JavaScript. JavaScript Training in Chennai JavaScript was used for little more than mouse hover animations and little calculations to make static websites feel more interactive. Let’s assume 90% of all websites using JavaScript use it in a trivial way. That still leaves 150 million substantial JavaScript Training in Chennai JavaScript applications.
 
Case Study Writing Service Provider are not that expensive for Custom Case Study Writing Services since they complete high standard Case Study Assignment Services?

 
Is acquiring outstanding Cheap Online Assignment Writing Services seem arduous for you? Seek Custom Assignment Writing Help from the Best Online Assignment Writing Services company.

 
Found your post interesting to read. Sometimes, It become troublesome to make time for writing assignments. We understand such situation. We provide you chemical engineering assignment help service for students and complete it for you before the deadline.

 
Excellent erudition Providing by your Article, thank you for taking the time to share with us such a nice article. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. Kindly visit the LiveWebTutors website we providing the best online assignment help services in Australia.

For More Info: Case Study Help
 
I cannot write an essay and an article myself. I need easy senior project topics. I've been looking for a long time with a friend. We found an essay writing service. Now we have more free time.

 
Any student in need of Online Religion & Theology Writing Services and Religion Essay Writing Services who places orders with our custom writing company is assured of receiving excellent Religion Research Paper Help Writing Services that are 100% unique.

 
Through our experts, we offer all kinds of Economics Essay Writing Services and Economics Research Paper Writing Services to suit the needs of every student when they are given any Economics Coursework Writing Services.

 
beneficial and knowledgeable.
Data Sgp
Data Hk
 
Are you encountering challenges searching for Psychology Coursework Writing Services? Look no further; Custom Psychology Writing Services has a solution to your Psychology Essay Writing Services.

 
It is important for college nursing students to seek help with nursing writing services from a reputable custom nursing research paper service company so as to be assured of good grades in their nursing research paper services.


 
My silver service values the quality of content provided to all customers, and to maintain this.
silver service cabs Melbourne
 
E-commerce research paper writers are hard to come across them for those in need of E-commerce Essay Writing Services and trade and e-commerce writing services.


 
Online business and information system coursework writing services seekers find it easy to access Information Systems Writing Services and IT research paper writing services since most information system essay writing services companies offer them.

 
Business information systems research paper services have become very popular for students studying business & information technology coursework as they engage the best online Information Systems Writing Services.
 
Reach the best academic web portal for quick and plagiarism free content at CrazyforStudy , the proficient experts ar available all time to help you.
 
This article is quite useful for many users, especially for students who frequently use the products of this company. Personally, I am currently working on an microsoft essay, so thank you for sharing such facts.
 
Religion and theology research paper writers are hard to come across them for those in need of Religion and Theology Research Writing Services and theology and religion writing services.

 
Finding the best healthcare assignment writing services and Medical Assignment Writing Services is not easy unless one is keen to establish a reliable custom medical research paper provider & medical writing service help online.

 
It is important to seek psychology research paper help services and psychology case study writing services since students find help when they visit Psychology Assignment Writing Services.

 
In our papers the body paragraphs support the thesis statement, with each body paragraph elaborating on one supporting point.

Help Hogwarts Papers
 
charlie analyzes every detail of my requirements and wrote special content for me. Thank you very much, charlie! charlie is a very talented, thoughtful, and professional writer.

Fiverr
 
Online health & safety essay writing services are very difficult to complete and many students are always searching for Health & Safety Writing Services to help them complete their health & safety research paper writing services and health & safety coursework writing services.
 
Finding the best biological science paper writing help and Biological Science Writing Services is not easy unless one is keen to establish a reliable biological science research paper provider & biological science coursework writing services.


 
Business Management coursework writing service learners have an advantage of hiring the best business research writing service that is familiar with business term paper writing services for their Business Essay Writing Services.
 
how to setup a network printer windows 10 or system printer for your home or office and need to introduce it on Windows 10? Contrasted with the past times, including printers in Windows.
 
Philosophy coursework writing service seekers have been on the rise lately since most learners need Philosophy Essay Writing Services, philosophy assignment writing services and philosophy research paper writing services.

 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?