Showing posts with label GIT. Show all posts
Showing posts with label GIT. Show all posts

Tuesday, May 20, 2014

Come back note and How to set GIT url password with special character

Haven't written a blog for a long time since I joined Microsoft. But I still believe, blog is a good place to share my learning and do potential benefits to other people. Let more people to have shorter learning curve as what I did. : ) 

Since I moved to Seattle, a lot has been changed in my life, therefore, this blog will not only about techniques, but also some home owner saving and maintenance tips as well. 

Hope everyone could enjoy. 

As a small benefits, sharing a a small hint, if you don’t know that already. :) 

Every time we push or pull in Git Command Line, we need to type in our username and password, this would be less desirable for us. Especially in windows, there is no out-of-box supporting for SSH for GIT. Therefore, using HTTPS could be a good alternative. 

For example in OpenCV, type in the following command line in Git we could set up the automation.  

git remote set-url origin https://username:password@github.com/username/opencv.git

But our issue is that some password may have special characters, such as #, $, @, this will break the url flow. The solution is just replace these special characters with url  encoding, (http://www.w3schools.com/tags/ref_urlencode.asp)

As an example, username: blastevil and password: blastevil@2014, the Git command line should be:  (@ in url encoding is %40)


git remote set-url origin https://blastevil:blastevil%402014@github.com/blastevil/opencv.git

Wednesday, September 12, 2012

Git: How to commit only one file from another branch

Problem claimed as title: How to commit only one file from another branch, (instead of the whole branch)

git checkout <branch-name> <path-to-file>

example: (here, we want to only merge the .gitignore file from desired-branch into current HEAD branch.)

git checkout desired-branch .gitignore


This answer is referred to the following url:
http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/

prettify