Your guide to local remote git repositories.

Did you know that that git allows you to connect to a remote repository that is not so, remote ? I mean, you can actually connect to a repo in another folder and push and pull directly to and from it. I was recently faced a scenario where I had two working versions of the same repo in separate directories. I needed to make the changes in one place but then confirm the changes in a different context.

A Few Lines of Command Line

I’m not sure how this will work on a git GUI client but for those who love the command line follow my simple instructions below.

Understanding remotes

remote in simple terms is simply just a copy of the same repository, somewhere else( GitHub, Bitbucket, private git server ). Git hub allows you add multiple remotes via this command:

 git remote add <name> <URI>
 git remote add companyrepo git@github.com:company/repo.git

After adding this remote you can fetch all the branches from it so you can compare it locally. To do this simply run:

git fetch

Now to see all the branches that’s been added  after the fetch request run :

git branch -a

If you need to read up more about remotes checkout working with remote.

The Remote Repo Next Door

So I thought, if I can do that with a url to a git repo surely git must allow directories on my local machine as well? So it was, git doesn’t distinguish between my local directory and a repository on a distant planet. So to get this working the first thing you’ll need to do is: ensure that you have 2 (or more) of the same repositories. What I mean by the same is that they are both cloned from the same origin. Now open the command line and proceed to the directory where the main repo is. This is the place where you’ll be working on your feature branch and committing code changes. Type `pwd` and copy the full path to the current repo’s directory. In my case:

/Users/dwain/dev_repo_main/

Change directories and move to the other directory where you want to add the remote. In my case:

cd /Users/dwain/dev_repo_other/

Once you’re in the second repo simply run this git command:

git remote add repo_main /Users/dwain/dev_repo_main/.git

After doing this you can check if it was added by running the following command.

git remote -v

You should see this:

origin git@github.com:company/repo.git (fetch) 
origin git@github.com:company/repo.git (push)
repo_main /Users/dwain/repo_main/.git (fetch)
repo_main /Users/dwain/repo_main/.git (push)

From this point forward you can make change in the main branch and pull them into your local branch.

git pull repo_main

Please note that when pushing to the

main_repo

it is advised that you create a feature branch before making your changes

 git checkout -b new-feature-branch

After making and committing your changes you can push this branch to the main repo and then change to the main directory to merge the new changes:

git push repo_main new-feature-branch
cd /Users/dwain/dev_repo_main/ 
git merge new-feature-branch

Add WordPress post type content programatically

To load dummy content programatically load the content below into your functions.php.

This function runs on every page reload so be sure to run it only once and then remove it. Firstly setup the number of posts you need and then also specify the post type. After doing this proceed to your website front end  and reload the page.

After this your dummy posts should be added. Remove that code from your functions..php file and check your admin dashboard.

This is a modified version of Tom McFarlin’s post ( http://tommcfarlin.com/programmatically-create-a-post-in-wordpress/ )

WordPress, why we really need front end editing

We all know quite a few online website creation tools that lets one create a website without touching a single line of code, but unless your the end user, this kind of solution is not something you’ll recommend to your client. The current basic WordPress website workflow: Designer/Developer completes the implementation of the theme and a few plugins and trains the new user how to use the site.

Usability
The user goes into the admin makes some changes and refreshes the page/website and checks out the changes in another tab (the neat trick you showed them). So they switch between admin and the front a few hundred times before they are 100% satisfied. All is well, the website launches and now they get to feel proud, but this where we need to pause and think . Why does the user have to switch between the admin and the the front end so many times to manage their website ?

All we need is Edit and Save
If we could improve the lives of our users and take a little more hassle out of maintaining websites I suggest we shift our current focus from structure and design to simple front end content editing. And when I say content, I mean any content on the page ( page content, menu names, widget text ). Any content easily editable in the admin should be easily editable in the front end.

We need front-end-editing to remove the extra clicks synonymous WordPress website management and place more power in the hands of the end users.

Now There are already developers paving the way toward a better WordPress editing experience.

I know this will soon play such and integral part as to how we’re managing our websites that we forget the time when we switched windows to view the final result.

 

 

Internet at aboard the pacific pearl

Working remotely for Woothemes which allows me to change my office location like I change my shocks. With this benefit my wife and I decided to take the opportunity to work out at sea.

She is the crew doctor for P&O cruise-liner in the south pacific just off the coast of Australia. Working at sea comes with a dozen plus benefits, but these doesn’t always include a stable internet connection from which I work.

On the current ship , the Pacific Pearl, this issue has almost been removed thanks to P&O moving to a new service provider http://harris.com/ . With this provider I’m able to get download speed of 2mb p/s and upload of 1mb p/s . Now this is really very basic but it is not dial up speeds, and you can get a decent amount of Work done with this connection.

The connection is still very expensive and may be down at certain times but I find it to work wonderfully for 80% of the time.

Start your Journey now

At this point in my life I am happy. I have a relationship with my heavenly Father through Jesus. I have a loving wife with who’m I’m excited to share the rest of my life with and together we are working towards common goals.

This blog post will serve as the official starting point of my Journey. I publish this in faith as I believe there will be others asking me about my journey and how I made and and i’d like to share my ups downs and what I have done but more specifically the mind set behind my success as a Software Engineer. Continue reading Start your Journey now

Your story matters, share it

We all have those times when really need inspiration. Most times we find it in the simplest places. It’s in books, blogs, talks even the little children, other times we draw inspiration from our industry leaders and people we look up to.

The leader you choose not to see

When speaking about great leaders our thoughts often go out to great names like Nelson Mandela, Winston Churchill and like, but you often fail to notice the leader staring back at you in the mirror. This leader , the one you fail to see, has a lot more to give than you can currently imagine.

Lead from where you are

Often we look for the position and the acceptance from other people before we will take charge and lead from our current position. We sometimes pass on each great opportunity because of fear.

Show us what you’ve got

Consider this for a moment. No matter how you see yourself, Someone looks up to you. So do them a favour. Tell your story. Share your journey with them. Talk about your failures and success. Share the the gift of your precious life.

I’m slowly sharing mine, so go on share yours. Blog about it, make a video or add it to your about me page. Host a talk. What ever you do, share it !

Let consistency be your trump card

When I see a kid so brilliant I often wonder if it is worth trying to compete.  I mean if I were to be a classically trained pianist at age 30, seeing  a kid at age 4 I would question my abilities in comparison to his.

The common thread

We all desire to be the best and to be recognised as such. Hence the ladders we climb in the corporate world, tribes and communities. Although we are not all like this it is a common trend that can’t be ignored.

Consistency trumps the WizKid

I am a firm believer that great men are not born, but that they are made. I am well aware that there are wiz kids out there who simply excel without the level of experience any normal human being would need, but they are not the what keep our economy afloat. They dazzle us but the aim is not to simply be impressive the aim is be consistent.

In some instances with a sheer stroke of luck the genius in the room takes home the bacon, but it has been proven over time that slow and steady wins the race.

Life Lessons learnt in support

On 1 December 2012, I started working full time as a support ninja at WooThemes.

Besides motoring away everyday at making clients happy, I have also been monitoring my progress along the way. Now by monitoring I mean physically counting the tickets and doing analytics and basic reflection. During  this time  I have found out that there are some valuable life lessons and disciplines that I got from simply doing support from day to day.

I’m continually learning, but I’ll be happy to share my lessons with you:

Continue reading Life Lessons learnt in support