How to make git-diff ignore specific lines

Recently I use git for versioning Cisco router/switch configurations. One problem here is the ‘ntp clock-period’ line. Cisco equipments have a clock adjustment value for NTP in their configuration and its value changes without any manual configuration changes. So even though I have made no changes in their configuration, git-diff shows lines like following. -ntp clock-period 36027555 +ntp clock-period 36027579 Because it will be adjusted automatically, usually no need to save an updated value. So I want them disappear when I do git-diff. The git-diff has ‘-G’ option to show changes matched with regex. But it has no option to avoid matched lines. Generally in such a situation, we use … Continue reading How to make git-diff ignore specific lines

Git and Windows Shared Folders

With the msysGit package (Git for Windows), we can use Git easily under Windows environments. Even if you want repositories on Windows servers, you can make it in shared folders. Yes, you need only shared folders instead of running git-daemon on your server. When you manipulate repositories on shared folders, you can use a syntax bellow to identify the repository without mapping the shared folder as a drive. //servername/folder/subfolder/repository If you want to create a new empty bare repository on a server. $ git init –bare //server/folder/git/myproj.git If you want to clone your local repository to a new bare repository on a server. $ git clone –bare myproj //server/folder/git/myproj.git When … Continue reading Git and Windows Shared Folders

WordPress in command line scripts

Though WordPress has wp-cron functionality to do scheduled tasks, I still like Unix crontab to do them. Fortunately, we can write script programs in PHP to run from a command line even if the scripts call WordPress functions. To do WordPress operation in a script, we have to include ‘wp-load.php’ before the operation. Below is a sample script to create a new post. You can run it from a command line. Before loading ‘wp-load.php’, you have to set PHP ‘$_SERVER’ variable. Especially in a multisite environment, WordPress will determine which site to involve by $_SERVER values. #!/usr/bin/php <?php // define(‘WP_DEBUG’, true); /* uncomment for debug */ $_SERVER = array( "HTTP_HOST" … Continue reading WordPress in command line scripts English Edition