My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Friday, March 24, 2017

Fatal: bad Object error in Git cherry-pick - Why Exception is thrown during cherry picking in Git ? *

In one of my earlier blog post, I explained how to cherry-pick in Git. To understand more about what does cherry picking a commit in git mean and how to do it, refer:
W3LC: Git Cherry Pick Command Tutorial

This post is to deal a situation when you get a fatal error in your attempt to cherry pick. The error is as follows:
"fatal: bad object"

So here I would like to explain why this occurs. The cause is that there is no information about remote branch on your local system.

Technically, if the branch is not locally present - you don't have the right data. You will errors like " fatal: bad object "

Solution:
To solve this you first need to fetch information on your local system. To do this use fetch command of Git.

1. fetch just the one remote
git fetch
2. or fetch from all remotes
git fetch --all

Here we should take a short break and understand what is Git Fetch command:

W3LC Definition: In the simplest terms, git pull does a git fetch followed by a git merge.
This means that the fetch operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy. A git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches. This updating your other remote-tracking branches is called as fetch.


So, let us assume that you fetched the information about all branches.

Now, make sure you're back on the branch you want to cherry-pick to. And use the git cherry-pick command again. Example:
git cherry-pick 9505ac61c924de0bba404f40f8abdc53af1909d8

Great. Now it should work!


Do also read if you want to change the name of your git branch. The process to do so is explained fully on my earlier blog post:
W3LC: Git Rename a Branch Name

Git : Cherry-pick a commit in branch

Friends, it a very common situation that if you are in a new branch of your own but want to bring information or changes from another branch.

Sometimes you also land in a situation where you have been asked to cherry pick a commit. But you have no clue idea what it means! Trust me. That was the case with me when i heard this while I was in Symantec. The history is that we used Perforce for the version control, but a new team started using Git. And cherry picking was something that needed a beer to actually understand ;)

So what does cherry picking a commit in git mean? How do you do it?

Solution:
Cherry picking in git means to choose a commit from one branch and apply it onto another.
Note that it is different from merge and rebase which normally applies many commits onto a another branch.

Syntax:
git cherry-pick

Example:
First make sure you are on the branch you want apply the commit to. For instance suppose you have to bring changes in master itself:
git checkout master

Now Execute the following:
git cherry-pick
Eg: git cherry-pick 3d05ac6159e4de0bba404f40f8abdca3af1903d3


Voila!
You're done. Just check your branch for the new changes. The diff history will show you changes in that commit to enter in your branch as well.

CAUTION:
In case you get an error like:
fatal: bad object 02x661db5adf2anwarJamalFaizeacf09f048b8b11
It means that the branch information is not locally present. To solve this I have already written another post. Thank me for this ;)  http://www.w3lc.com/2017/03/fatal-bad-object-error-in-git-cherry.html


Note:
Do also read if you want to change the name of your git branch. The process to do so is explained fully on my earlier blog post:
W3LC: Rename Branch Name in Git

Git : Rename / Change Branch name : How to Change the branch name of a local or a remote branch in git

There are multiple scenarios if you want to change the name of the branch. Sometimes you could have named a branch incorrectly, and sometimes it could be because you didn't follow the naming guidelines as per your team and organisation. Whatever be the cause, you very well need to know the method to do so.


The process is as follows:

1. First, rename your local branch.  (Sometimes you need to only do this. For example if the branch is yet not pushed on stash.)
If you are on the branch you want to rename:
Syntax: git branch -m new-name


2. In case you are on a different branch:
Syntax: git branch -m old-name new-name


3. Now suppose you want o delete the old remote branch and push the new-name local branch.
Syntax: git push origin :old-name new-name


Or, 4. You can also reset the upstream branch with the new branch local branch.
For this you need to switch to your new local branch and then:
Syntax: git push origin -u new-name

Tuesday, February 28, 2017

CD with mapped mounted drive on network : CHDIR command


It has happened with me that I was able to succesfully mount a network drive and can freely access it using Windows file-system Explorer. But my script was not able to access it. Digging a step further, i noticed that I could not even CD to that drive on command prompt. Hence i finally wrote this blog post for anyone running into the similar issue.

Question : How do I change to a mapped network drive at the command line?

Issue:
Say, you have a networked drive mapped to "U:\"
Now you want to go to that drive from a command line.
However, when you try you get an error suggesting
C:>u: The system cannot find the drive specified.


Solution:
There are two aspects to the solution:
1. The Syntax to use CD command on Windows may be the cause. Remember that for changing directories you should use cd /d U: rather than just U:
2. You should first start using the map drive on command prompt. Command used to do that is as follows:
net use u:

See attached screenshot showing the error as well as what happened after solution.




C:\Users\mfaiz\Downloads>net use p:
Local name        p:
Remote name       \\sxa.xxx.xxx.com\ap-xxx
Resource type     Disk
The command completed successfully.

Tuesday, January 3, 2017

What is BHIM App? Android Payments App in India for Unified Payment Interface (UPI)

The Bharat Interface for Money (Bhim) app was launched on 30 December by PM, India.The app is developed by the National Payment Corporation of India (NPCI) and uses Unified Payment Interface (UPI) for the transactions. The app is very simple to use, has a clean interface and incorporates multiple security features. Industry stakeholders have called the app a gamechanger when it comes to the ease of making cashless payments in India. However, the application faced extremely high server loads on launch day.


As explained on the Google Android Playstore, BHIM is an initiative to enable fast, secure, reliable cashless payments through your mobile phone. BHIM is interoperable with other Unified Payment Interface (UPI) applications, and bank accounts. BHIM is developed by the National Payment Corporation of India (NPCI). BHIM is made in India and dedicated to the service of the nation.



How does it work - BHIM usage guide:


Register your bank account with BHIM, and set a UPI PIN for the bank account. Your mobile number is your payment address (PA), and you can simply start transacting. Yes! It is that simple.


Send / Receive Money: Send money to or receive money from friends, family and customers through a mobile number or payment address. Money can also be sent to non UPI supported banks using IFSC and MMID. You can also collect money by sending a request and reverse payments if required.


Check Balance: You can check your bank balance and transactions details on the go.


Custom Payment Address: You can create a custom payment address in addition to your phone number.


QR Code: You can scan a QR code for faster entry of payment addresses. Merchants can easily print their QR Code for display.


Transaction Limits: Maximum of Rs. 10,000 per transaction and Rs. 20,000 within 24 hours.


Which Banks support BHIM App?
What all Banks support are inter-operable with UPI?

Supported Banks are listed as follows. This information is sourced from the App description itself:
- Allahabad Bank
- Andhra Bank
- Axis Bank
- Bank of Baroda
- Bank of Maharashtra
- Canara Bank
- Catholic Syrian Bank
- Central Bank of India
- DCB Bank
- Dena Bank
- Federal Bank
- HDFC Bank
- ICICI Bank
- IDBI Bank
- IDFC Bank
- Indian Bank
- Indian Overseas Bank
- IndusInd Bank
- Karnataka Bank
- Karur Vysya Bank
- Kotak Mahindra Bank
- Oriental Bank of Commerce
- Punjab National Bank
- RBL Bank
- South Indian Bank
- Standard Chartered Bank
- State Bank of India
- Syndicate Bank
- Union Bank of India
- United Bank of India
- Vijaya Bank


Features lacking in BHIM App and other Security Concerns with BHIM App:

Presently, Languages supported are Hindi and English. More languages have to come soon to support regional languages of India. Also, there are many initial pain-points in the App that are listed as following:

We should revisit the transaction Limits: (Presently it is Maximum of Rs. 10,000 per transaction and Rs. 20,000 within 24 hours.)

Some have reported that the App is only useful if you have a debit card The app has good intentions and i appreciate it. To register an account under upi, the app forces one to enter partial details of the debit card details. I consider this as a requirement gap.

Some say that it is waste of time and stucks or hangs at many places

Security concerns are there. Undoubtedly, it needs PCI clearance and has to scale good on OWASP threat scales. Presently, there is no clear documentation describing these fine details. IT savvy folks are presently not joining the BHIM revolution.


As a conclusion, I would say that it is a good start. More focus should be given on security. And, also since the App is majorly controlled by government officials, proper business continuity plans and threat mitigation units shall be setup. For a proper success, we should be good on security scales as we are not so strong on the corruption index ;)

All in all, Congratulations for the Banks and NPCI to come up with this App. For easier and seamless Payments systems and a boost in digital market, initiatives like these shall be the corner stones. Lets wish the App and initiative the best of luck. May we prosper. May we excel.

Cheers :)

For more information: visit https://upi.npci.org.in/static/faq/en_US/