Switch branch and ignore any changes without committing

Following is the way to do this:

git stash save
git checkout branch
// do something
git checkout oldbranch
git stash pop

Indeed what it says (to be complete):
git stash save OR git stash (when in working branchY)
then git checkout branchX do something on branchX such as git add/commit -m etc.
git checkout branchY again and
git stash pop to get back the stash

Reference:

https://stackoverflow.com/questions/1304626/git-switch-branch-and-ignore-any-changes-without-committing

Advertisements

How to undo ‘git add’ before commit on git ?

We can undo git add before commit with the following command ..

git reset

Which will remove it from the current index (the “about to be committed” list) without changing anything else.

We can also use

git reset

without any file name to unstage all due changes. This can come in handy when there are too many files to be listed one by one in a reasonable amount of time.

Reference:
https://stackoverflow.com/questions/348170/how-to-undo-git-add-before-commit

The way to search through posts by ID in WordPress admin panel

Here we can do it ….

Please add the following code in your functions.php file.


add_action( 'parse_request', 'idsearch' );
function idsearch( $wp ) {
global $pagenow;

// If it's not the post listing return
if( 'edit.php' != $pagenow )
return;

// If it's not a search return
if( !isset( $wp->query_vars['s'] ) )
return;

// If it's a search but there's no prefix, return
if( '#' != substr( $wp->query_vars['s'], 0, 1 ) )
return;

// Validate the numeric value
$id = absint( substr( $wp->query_vars['s'], 1 ) );
if( !$id )
return; // Return if no ID, absint returns 0 for invalid values

// If we reach here, all criteria is fulfilled, unset search and select by ID instead
unset( $wp->query_vars['s'] );
$wp->query_vars['p'] = $id;
}

All you then do is search using the regular search box using a #(hash) prefix infront of the numeric ID.

#123

..would return the post with an ID of 123.

Ref: https://wordpress.stackexchange.com/questions/9276/search-posts-by-id-in-admin

How to prepare HTML5 ad with click tracking for DoubleClick for Publishers

You received from advertiser HTML5 zip bundle and uploaded it to DoubleClick for Publishers (DFP) with HTML5 type and got following message: “Warning: Missing click tag. Add a valid click tag or exit function before uploading the creative to DFP.”?

Please follow the link below:

https://www.genecy.com/blog/25-how-to-prepare-html5-ad-with-click-tracking-for-doubleclick-for-publishers/