This is a concoction of geeky posts, programming posts and just general stuff that is in my brain.

It might be updated often but then again it might not...

 

 

Pushing a local Git repository to a new remote repository

For reasons completely unknown I find it *really* difficult to remember the syntax in Git to push a new local repository to a remote destination.

So to stop from scratching my head about it, I am going to put it here. Two reasons:

1. so I know I can find it

2. it might help someone else looking for it

So, you've create a local git repository on your machine and what to push it to a remote server? (In this example I am going to use http://BitBucket.org)

Firstly, log in to BitBucket and create a new blank repository.

Once that is done, using git bash in your local repository execute the command

git remote add origin git@bitbucket.org:{BITBUCKET_USERNAME}/{REPO_NAME}.git

Obviously, replacing {BITBUCKET_USERNAME} & {REPO_NAME} with the real values!

This will add the the BitBucket URL as a local remote alias called "origin" to your local repo.

Now you need simply need to push your local repository (usually called master) to your remote repository. Which is called origin as we have just given it that alias!

To be clear, you can call your remote alias anything you like it doesn't have to be origin. In this instance calling your alias bitbucket would make sense.

git push origin master

And that is all you need to do! Really simple but for some reason I can never remember it.

As a side note, there is also a really handy git reference guide on GitHub

Posted by codingbadger at 13:28

Scripting out the Schema & Data in SQL Server 2008

SQL Server 2008 has a neat feature that allows you to script out an object. Not really ground breaking so far. However, where this differs from SQL 2005 is that you can script out:

  • the schema
  • the data
  • the schema & data

You would think this option is available to you by right clicking directly on the object (typically a table for scripting out data and schema) but it isn't - you have to start on the database.

Right click on your database and select Tasks >Generate Scripts...

Step _One _Generate _Scripts

This will fire up a wizard to generate the scripts for you. 

Click Next and you will be prompted to select the objects you want to script out. I am going to choose one table for this purpose as it's easier.

Step _Two _Select _Object

Click Next

This is the important part, by default SSMS defaults to Schema Only to amend this to include the data you need to click Advanced

Step _Three _Click Advanced

Now scroll down to the proprty named Types of data to script and select an option from the drop down.

Step _four _type _of _data

Click OK and follow the rest of the wizard.

And there you have it, a simple way to script out your schema and data via SSMS 2008.

 

Note: If you are on SQL Server 2005 then I would recommend using an add-on such as SSMS Tools Pack as it includes this type of functionality which isn't available pre SQL 2008.

Posted by codingbadger at 13:05

Authors

Recent Comments

Powered by Disqus