Simple Answer:
getline: As the name suggests, gets everything till it encounters a "\n" newline character. Here, input is always considered as a string.
So, if you write:
string someStr;
getline(cin, someStr); //here if you enter 55, it will be considered as someStr="55";
">>" (Bitwise right shift Operator): Is smart and dumb at the same time.
It will get input in any Basic Data types that you define, but it will stop at the first non Data Type char encountered.
E.g.
int someInt;
std::cin >> someInt; //here if you enter "55some", >> will only consider someInt=55;
So, if you write:
string someStr;
cin >> someStr;
here, if you enter, "I am Batman", cin understands that "I" is a string, but " " (space is not), so it stops at I and you will get someStr="I".
IMP Point:
If you use >> and getline back to back you will run into problems.
for >>, even the "\n" (newline char) is not a Data type.
So, if you write,
int someStr, someStr2;
std::cin >> someStr; //here you enter "Batman"
getline(cin, someStr2); //here you enter "Bruce"
since, >> does not recognize "\n" char, it will only see "Batman" and exit the buffer, leaving the "\n" for someStr2. So, someStr2 will not get "Bruce", but ""(new line char).