Tuesday, 19 May 2015

How to configure SourceTree to use external diff - P4Merge

1>Just download your preferred merge/diff tool , like beyond compare or P4Merge(free)

2> SourceTree -> Tools -> Options -> Diff

Choose your tool, in my case P4Merge which support 3 way compare and free.

3> Click on a changelist and a file , Ctrl + D, then it will lunch P4Merge just like under Perforce.

How to use SourceTree with BitBucket on windows behind firewall - Get Started

This tutorial assume you know some basic Git.

1> Download Git and install on your machine. Detailed information can be found here if needed.
Make sure you have setup the basics from a Git Bash:
git config --global http.proxy http://server_ip:port

2> Download Putty from here and install.
3> Setup your HTTP Proxy settings in Putty
Click on your Start button and search for Putty
When Putty comes up goto the Session Category 'Default Settings' and then Load
Goto the Proxy category and add in the proxy settings, making sure to select the right proxy type
Go back to the Session Category and save the updates to the Default Settings

4>Download SourceTree for windows here and install.
You will be asked your BitBucket account username and password once you installed this but you can choose to skip it at this stage.
5>Config SSH for SourceTree
(1)Open SourceTree, goto Tools and select 'Create or Import SSH Keys'

(2)A dialog will open up. Click Generate to generate a public private key pair.

(3)Provide a suitable passphrase and save both the public and private keys.
(4)Login into Bitbucket via browser -> Manage account -> SSH keys -> [Add key],
then add the generated public key in there.
(5)In your system tray, right click on Pageant (PuTTY authentication agent) and select "Add Key" ,
then select the private key generated above.

<6> Login BitBucket, go to the repository that you need to start working on, click on the [Clone in SourceTree] button 

This will lunch SourceTree and 'download' the repository to your local. You can choose which branch to checkout.

Now you can start working on the branch you interested in (add, commit, push, pull etc).

The SourceTree configuration data are stored under
C:\Users\<user name>\AppData\Local\Atlassian\SourceTree
C:\Users\<user name>\AppData\Local\Atlassian\.exe_Url_<xxxxxxxxxxxxxxxxxxxxxxxxxxx>

Installing putty on windows


PuTTY provides SSH connectivity for Windows and emulates an xterm terminal. This allows users to connect to our Linux machines remotely from a Windows environment.
For more information, please visit the PuTTY homepage.


Download and run the current setup executable available here. You will see the following intro screen. Click [Next].
Installation Step 1
The default installation location is recommended. Click [Next].
Installation Step 2
The Start Menu folder is simply the name of the sub directory under which your PuTTY shortcuts will be located. The default value should be fine. Click [Next].
Installation Step 3
Additional tasks include creating shortcuts in various locations to make PuTTY SSH easier to access. The following option set is reasonable. Click [Next].
Installation Step 4
The installer will verify the settings. If everything looks as you set it in previous steps, click [Install].
Installation Step 5
Following a brief installation status screen, you should see the following dialog indicating successful installation of PuTTY. You are now equipped to connect to our clusters remotely. Uncheck "View README.txt" and click [Finish].
Installation Step 6TIP 1: To avoid re-entering your preferences each time you connect to a machine, you can save your settings in a specific session, or to have the settings available at all times and applied to all future sessions by default, save your settings to "Default Settings" session. To do this, in the "Session" configuration window, type "Default Settings" into the "Saved Sessions" field, and click [Save]:
Saving Default SettingsTIP 2: To save a session to a specific host, i.e. hammer.rcc.psu.edu, enter the host name in the "Host Name" field, then name the session using the "Saved Sessions" field, and click [Save]:
Saving a SessionTo access this session in the future, you can simply double-click the session name in the list-box or create a shortcut in your Start-Menu or on your desktop pointing to your PuTTY binary ("C:\Program Files\PuTTY\putty.exe" by default) using the flag "-load hammer" where you replace "hammer" with your selected session name:
Session ShortcutYou can change the shortcut's name by selecting the "General" tab and entering your desired name into the text field:
Session Shortcut Name

Configure X11 Forwarding in PuTTY SSH

In the Putty configuration window, select "Connection->SSH->X11" and make sure the "Enable X11 forwarding box is checked, then return to the Session category and click [Open] when you are ready to connect to the specified machine:
Putty X11 Forwarding

Setting your username

In the Putty configuration window, select "Connection->Data" and type your username into the "Auto-login username" field, then return to the Session category and click [Open] when you are ready to connect to the specified machine, or return to the "Session" window and save your settings:
Putty Username Setting

Branch or fork your repository

Branch or fork your repository

What is a branch? What is a fork

Branching and forking provide two ways of diverging from the main code line. Both Mercurial and Git have the concept of branches at the local level. A repository code branch, like a branch of a tree, remains part of the original repository.  The code that is branched (main trunk) and the branch know and rely on each other. Like a tree trunk's branch, a code branch knows about the trunk (original code base) it originated from.
Fork is another way of saying clone or copy. The term fork (in programming) derives from an Unix system call that created a copy of an existing process. So unlike a branch, a fork is independent from the original repository. If the original repository is deleted, the fork remains. If you fork a repository you get that repository and all of its branches.
As DVCS hosting evolved, the term fork evolved. The Bitbucket software adds management to forks; forking a repository in Bitbucket has functionality you normally wouldn't associate with a simple DVCS clone. For example, on Bitbucket, you can always see which repository the fork came from. This isn't the case with a DVCS clone on your local system.

A comparison of branching and forking

Whether you use either branching or forking, and to what extent, depends on your working environment. There are lots of ways a team can work with and combine fork and branch functionality. You can google for discussions about this. Generally, for hosted systems, forks work well in situations where, as a repository admin:
  • You don't want to manage user access on your repository. 
  • You want fine-grain control over merging.
  • You expressly want to support independent branches.
  • You want to discard experiments and changes easily.
The Bitbucket team recommends branching for development teams on Bitbucket; We use a modified form of Vincent Driessen's GitFlow technique.  Bitbucket branches are useful when:
  • You have a small group of programers who trust each other and are in close communication.
  • You are willing to give the development team write access to a repository.
  • You have a rapid iteration cycle.
Ultimately, though it is your choice – branch or fork – Bitbucket supports both.

Cloning a repository fork or branch

When you want to work on a project by updating its files or adding new files, you need to make a local clone of the remote Bitbucket repository onto your machine or local network. You do this using the Clone button from the Bitbucket repository.  If you forked a repository, you simply clone the fork.  If you branched a repository, you clone the repository and checkout the branch.


What is Fork

In software engineering, a project fork happens when developers take a copy of source code from one software package and start independent development on it, creating a distinct and separate piece of software. The term often implies not merely a development branch, but a split in the developer community, a form of schism.

A fork doesn't necessarily mean the developer isn't happy with the main repo. Typically, it means that another developer has read, but not write, access to that repo. The developer can fork the repo, make changes but since he can't write to the main repo he has to submit his changes as a patch. So, forking is also a means of encouraging collaboration without granting write access.

You could say that a fork is a branch that is not expected to be merged upstream

There are two main approaches to collaboration in git repositories. The first, detailed above is directly via branches that people pull and push from/to. These collaborators have their ssh keys registered with the remote repository. This will let them push directly to that repository. The downside is that you have to maintain the list of users. The other approach - forking - allows anybody to 'fork' the repository, basically making a local copy in their own git repository account. They can then make changes and when finished send a 'pull request' (really it's more of a 'push' from them and a 'pull' request for the actual repository maintainer) to get the code accepted.

This second method, using forks, does not require someone to maintain a list of users for the repository.

Total visitors since Jan 2012

World Visitor Map