Currently, I have created my branch dev-harry but I cannot pull it successfully as follows. harryxiyou@common_vm ~/forest/kvplus/kvplus $ git branch * dev-harry master rc harryxiyou@common_vm ~/forest/kvplus/kvplus $ git pull You asked me to pull without telling me which branch you want to merge with, and ‘branch.dev-harry.merge’ in your configuration file does not tell me, either.
Read more
Tag: Git
Tutorials and howtos on git configuration and usage.
How to change the commit message of a commit in the history (not HEAD)?
Posted onA commit is not the HEAD now. and git commit –amend will not work for it. How to change its commit message? You can use git rebase together with git commit –amend as follows. Assume your commit to be edited is 2b8ed. $ git rebase -i 2b8ed^ Change the pick to edit in the line
Read more
How to create a git branch on remote git server
Posted onWe may need to maintain a dev-name branch on git remote server to share your codes. How to create the branch? 1, git checkout -b your_branch_name 2, Do your changes, add commit 3, git push origin your_branch_name References:http://stackoverflow.com/questions/1519006/how-do-you-create-a-remote-git-branch
Git diff with long lines
Posted onI find git diff output is not easy to read when the text file contains long lines that is long enough to exceeds the screen size. We may not forbid the using the long lines for all files. How to handle lone lines in git diff better? Two possible methods to make git diff with
Read more
How to clone a snapshot of a remote repository at a specific branch?
Posted onI know that one can make a zip of the current branch by: git archive -o archive.zip HEAD However, at situations, one may want to clone a copy/snapshot of remote repository at a specific branch because: 1) The repository is large with long history and cloning the whole history takes too much time. 2) What
Read more
How to view a file at a specific commit in git?
Posted onHow to view a file at a specific commit/revision in git? You can use git show to view a file’s content at a specific commit in git: https://www.systutorials.com/docs/linux/man/1-git-show/ $ git show REVISION:/path/to/file You can also save a copy by $ git show REVISION:/path/to/file >file.copy
How to import a googlecode git project to github project
Posted onI wanna migrate leveldb (code.google.com/p/leveldb) to my github repository. Create a new repo on github.com with this link https://help.github.com/articles/creating-a-new-repository git clone https://code.google.com/p/ project-name.git Set the remote origin url as follows: git remote set-url origin https://github.com/ username/ repo-name.git git pull to pull the latest. git push origin master after making local changes. This is the original
Read more
Patching with git
Posted onTutorials on how to create patches and apply patches with git. A nice tutorial: https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/ Manuals: git format-patch: https://www.systutorials.com/docs/linux/man/1-git-format-patch/git apply: https://www.systutorials.com/docs/linux/man/1-git-apply/
Git branching tutorial
Posted onGood tutorials on git branching. The “Git Branching” chapter of Pro Git book is the best one that I ever seen: http://git-scm.com/book/en/Git-Branching It deserve the time to study the whole chapter. If you are working with a git server, this chapter is especially useful: http://git-scm.com/book/en/Git-Branching-Remote-Branches
Changing a git commit message after I have pushed it to the server?
Posted onHow to change a wrong git commit message after I have pushed it to the server? If the remote repository is shared with others, it is better to let the wrong git commit message there. If you use the repository by your own and you are sure that no one else has pulled your latest
Read more
How to get the git commit tree?
Posted onHow to get a tree-like view of the git commit history? My favorite command line: git log –graph –oneline It will prints a text based graph like (with colors): * b5dc8b9 Merge branch ‘master’ of https://github.com/layerzero/libi0 | | * 7514ef1 revised the README.md a little bit | * 6692428 align size to page for both
Read more
How to change the default text editor on Linux
Posted onOn Linux, a default editor is used for text editing such as crontab -e or git commit. How to change it to the editor of my own choice? The default editor is indicated by the EDITOR environment variable. You can set this environment variable to set the default editor. For example, set it to emacs
Read more
How to install drivers for TL-WN725N v2 USB wireless adapter on Fedora 19
Posted onI had a TP-Link TL-WN725N v2 USB wireless adapter. But it seems the kernels in Fedora 19 have not yet included drivers for it. How to install drivers for TL-WN725N v2 on Fedora 19? The driver is under development. You can find the source here and in the drivers/staging in the Linux kernel. If you
Read more
How to prevent roommates from hogging bandwidth
Posted onI share a ADSL modem via a Wifi router with several roommates. Sometimes, I find the network bandwidth left is too little. Suspiciously, some one is using BT, Thunder, eMule or other P2P tools. These tools can easily use up all the bandwidth and left little for others. How to prevent some roommates from hogging
Read more
How to revert only one file back to a revision or commit
Posted onI messed up with one file in one repository and want to check out only that file back to a commit. How to achieve this? To check the file with my_file.name at git commit commit_sha1: $ git checkout commit_sha1 my_file.name You can also use the relative commit instead of commit_sha1 such as master~4, HEAD~4, HEAD^,
Read more
How to use different keys for different git servers?
Posted onI have access to different git servers. I have several keys for these servers. How to use different keys for different git servers? Use the .ssh/config file to specify different configuration for different SSH servers used by git: For example: Host git.example.org Port 22111 IdentityFile ~/.ssh/id_rsa.git.example.org Host code.example.org Port 22 IdentityFile ~/.ssh/id_rsa.code.example.org which specifies the
Read more
Add the jane street opam repository
Posted onHow to add the jane street opam repository is introduced here. Here, we assume the branch to add is core-branch. You may need to replace the core-branch with the branch you need. $ git clone -b core-branch https://github.com/janestreet/opam-repository.git $ opam repo add js opam-repository Or, directly add the remote branch as an opam repository. $
Read more
Excerpt in homepage, category, tag and author pages for WordPress theme Twenty Thriteen
Posted onExcerpt in homepage, category, tag and author pages for WordPress theme Twenty Thriteen. Also add the “read more” link after the excerpt. The patch: diff –git a/wp-content/themes/twentythirteen/content.php b/wp-content/themes/twentythirteen/content.php index 4f61b22..53b4686 100644 — a/wp-content/themes/twentythirteen/content.php +++ b/wp-content/themes/twentythirteen/content.php @@ -30,7 +30,7 @@ </div><!– .entry-meta –> </header><!– .entry-header –> – <?php if ( is_search() ) : // Only display
Read more
Question2answer: show excerpt in the RSS feed
Posted onThere is a “Include full text in feeds:” option in the “RSS feeds” configuration panel but no options/method to only show excerpt instead of the “full text” or nothing for RSS feeds. This need to hack the question2answer source code. Details are in the answer. The changes based on Question2asnwer 1.5.4: diff –git a/qa-include/qa-index.php b/qa-include/qa-index.php
Read more
How to list a git repository’s all branches on the remote server?
Posted onI can list all local branches by git branch How to list a git repository’s all branches on the remote server? You need the -r option: git branch -r From the man page of git-branch. -r List or delete (if used with -d) the remote-tracking branches.