When specific commit from a certain branch and picked to some other branch it is called as cherry pick. Usually people work on different branches forked out of main branch in git repository. Now When we merge a branch in our branch we get all the commits, however when we pick specific commit from a branch to consumes or add it in our branch it is known as cherry pick.
There are several ways to do it, I would explain a simple way to do it using source tree.
1. Check out the branch you want to use or you want the commit to be picked up (consumed)
2. Choose to show all branches and not current branch only in drop down.
3. Now right click on the commit you want from other branch and select cherry pick option.
4. If there are not conflicts, every things is clean then you will get the cherry picked commit on your branch.
5. Push the commit to your origin.
Here are the simple steps to configure your author name in Git.
Configure the Name in Git to avoid unknown in author name
1. Click tools
2. Go to options
3. Click General
4. Insert your name and ep email id an save it
If you want to follow command line :
$ git config –global user.name
$ git config –global user.email email@example.com
Tag creation in GIT using source tree in simple steps :
1. select a commit to be tagged
2. right click and pick tag option
3. Provide tag name (lable)
4. Click add tag and push it to remote
In case if you want to do the same using command prompt / shell the fire below commands
git clone <repo-address>
git tag -l
git checkout <tag-name>
git branch -D master
git checkout -b master
Renaming an existing branch in git repository is easy and simple. This method applies to renaming a branch in your local repository. Changes will reflect in the remote repository after you make a push.
If you are in the branch that you need to rename
git branch -m <new_branch_name>
If you are not in the branch that you need to rename
git branch -m <branch_you_want_to_rename> <new_name>
Note : Please remember, once you rename a branch, the branch with old name exists and a new branch with new name is also created. So please remember to delete the old branch from remote once renamed branch is created after the push.
Follow steps :
1. Switch to the branch you want to rename, then rename it it locally:
git checkout old_branch
git branch -m old_branch new_branch
2. Remove old branch from remote repository:
git push origin :old_branch
3. Push the renamed local branch to remote repository:
git push origin new_branch
If you have decided not to use the recommended HTTPS method, we can use SSH keys to establish a secure connection between your computer and GitHub. The steps mentioed in the link will walk you through generating an SSH key and then adding the public key to your GitHub account.
Link : https://help.github.com/articles/generating-ssh-keys
Git makes it simple to do a time travel seamlessly. One can easily get to any state of application without much hassles, just by a simple click of git. Actually git preserves the delta of code and applies it when any checkout that revision.
Traditionally if as a developer I have made changes before the demo and found out at the last moment that application is screwed. Now it is difficult to take previous version of all files where app was stable using SVN since there is nothing like local commit. However with “SVN update revisionnumber” one can get back the remote application state. With git making restore point by local commit and reverting back to it is possible. This eliminates the need to take a backup at every stable state since it can be attained at any point in time at any development sand box itself. In short with git you can have restore point in your local machine as well by the means of local commits.
git reset <revision number>
git –hard <revision number>