Git Notes from Udacity Courses

Just finished working my way through this https://eu.udacity.com/course/how-to-use-git-and-github–ud775 very useful course in Git.

These are my notes:

  • git init : Create a repository
  • git status: Current status
  • git log –oneline : View log of changes to a repo summarized on one line per commit
  • git log –stat : Display the files that have been changed in the commit, as well as the number of lines that have been added or deleted
  • git log -p : display the actual changes made to a file
  • git log -p –stat : it displays both with the patch info above the stats info
  • git log -p –stat -w : it displays both with the patch info above the stats info ignoring whitespace changes
  • git log -p {SHA} : Display the actual changes made to a file for a specific commit
  • git show: Details of current commit
  • git show {SHA}: Details of specific commit
  • git show -p –stat -w {SHA}: Details of specific commit see notes on git log above for use of flags
  • git tag -a v1.0 : Add a Tag to current commit. NB. If you are using Git Bash or some other outing of the VI Editor to save your changes and quit, press ESCAPE, type :wq and press ENTER
  • git tag : Display all tags in the repository
  • git log –decorate : Details of current commit plus tag(s)
  • git tag -d v1.0 : Delete a Tag
  • git tag -a v1.0 a87984 : Add tag to a specific commit
  • git branch : List all branches in repo
  • git branch {branch name} : create new branch
  • git branch -d {branch name} : delete branch
  • git log –oneline –graph –decorate –all : The –graph flag adds the bullets and lines to the leftmost part of the output. This shows the actual branching that’s happening. The –all flag is what displays all of the branches in the repository.Running this command will show all branches and commits in the repository
  • git merge : There are two types of merges:
  • Fast-forward merge – the branch being merged in must be ahead of the checked out branch. The checked out branch’s pointer will just be moved forward to point to the same commit as the other branch.
  • the regular type of merge
    two divergent branches are combined
    a merge commit is created
  • git commit –amend : Modify the latest commit
  • git revert : Revert changes in a given commit
  • git reset :used to reset (erase) commits
  • git reset –mixed : takes changes in commit and moves them to the Working Directory
  • git reset –soft : takes changes in commit and moves them to the Staging Directory
  • git reset –hard : takes changes in commit and erases them
  • q – quit out of viewing the log

Update

There is also another course on Udacity for using git and github to collaborate with other developers.

GitHub & Collaboration

This really is worth a look as it helps you build on the material from the previous course.

There is also an app for learning how to use Git and Github available here:

Git-it is a (Mac, Win, Linux) Desktop App for Learning Git and GitHub

Posted in Git, Version Control

Desktop Application with Python

This post covers creating a GUI Desktop application with Python including creating a windows executable so that the application can be distributed to users who may not have Python dependencies installed.

The program takes the credentials for accessing a Woo Commerce website API, obtaining a list of categories in JSON and exporting those to a csv file. The source code is very much at the Proof of Concept stage at the moment but I will be updating it as I progress in learning the Tkinter GUI framework.

You can find the source code and an example of the generated .exe on github here https://github.com/mogstuff/wooGui

The main packages used include woocommerce, csv, json, and tkinter.

For distributing the application I used pyinstaller on a Windows 7 laptop, there’s a nice straightforward example available here: https://mborgerson.com/creating-an-executable-from-a-python-script

Posted in Python

Paypal Sandbox and WooCommerce

Found a great, straightforward article today on setting up Paypal Sandbox Testing on a WooCommerce wordpress website.

Just a quick caveat. If you’re not in the US you’ll need to sign up for a PayPal account at PayPal.com

Instructions

Here’s a very short list of instructions

PayPal Sandbox

  • Sign Up for a PayPal Account for your online business
  • Login in to https://developer.paypal.com/
  • Set up a Merchant account and a Buyer account under ApplicationsSandbox Accounts

WooCommerce

  • WooCommerce – Settings – Payment Gateways – Paypal
    • Check Enable Paypal Standard
    • Enter Your PayPal Test merchant email in the PayPal Email and Receiver Email boxes.
    • In the Gateway Testing section check Enable PayPal sandbox

That’s it you should be ready to run test transactions through your website.

Posted in wordpress, wordpress plugins

Enable Mod Rewrite in WAMP on Windows

As I have to keep looking this up periodically, I’m making notes for this here. The most straightforward write-up I’ve seen on this of late can be found here.

How to enable mod rewrite in WAMP

  • Click on the WAMP control panel, usually in the task bar, and go to Apache – httpd.conf
  • Uncomment the line: LoadModule rewrite_module modules/mod_rewrite.so
  • Find the bit that looks like:

    <Directory>

    </Directory>

    Change the settings to:
    <Directory>

    Options All

    AllowOverride All

    </Directory>

  • Restart Apache
Posted in Php

How to Add Export to PDF and Print Buttons to Your WordPress Pages Easily

Yet another fantastic plugin from Joost de Valk Print Friendly and PDF Button makes adding Print and PDF buttons to your posts or pages an absolute breeze. No need for any print css either. Can’t recommend this enough.

Posted in wordpress, wordpress plugins

Planning Your Website Content Structure for Better SEO

I’m currently in the process of making my own website’s information architecture make sense and follow some sort of logical pattern. As it’s very much a work in progress at the moment it can seem a bit confused, even to me.

Intelligent site structure for better SEO!

This article from Joost de Valk offers some great advice on planning out your website’s structure before you build it.

Another article by Trond Lyngbo –
The Pillars Of Strategic SEO & A Primer On Website Design
makes you ask yourself questions like, What is this Page for, what am I trying to achieve here? and goes into great depth about how your website should be planned out.

Some other resources I have found useful on this topic:

Posted in SEO

How to Post to Social Media Automatically

This Plugin NextScripts: Social Networks Auto-Poster looks well worth a look. I’ll update this post when I’ve taken it for a spin.

Posted in wordpress, wordpress plugins