In this week's parsha , Yosef first tells his brothers that he will tell Pharaoh that his family are shepherds and cattlemen. Then he tells them when Pharaoh asks them what their occupation is , they should answer - cattlemen. However , the brothers don't listen to him and instead answer that they are shepherds. Finally , Pharaoh responds to the brothers answer by asking them to take care of his cattle ! What is going on here?
So the starting point is to ascertain why he felt the need to say both positions.
The Netziv makes a clear delineation:
והאנשים רועי צאן. והודיע לאחיו תכלית הודעה זו לפרעה כי יהיו תועבת מצרים וממילא יגזור פרעה מעצמו שישבו בארץ גושן מקום שאין שם עיקר הישוב של מצרים
The men are shepherds - And he (Yosef) informed his brother of the purpose of this message to Pharaoh, so that they would be an abomination of Egypt (since sheep were worshipped there), and it will come out that Pharoah will decree from himself that they will dwell in Goshen a place which is not within the main settlement of Egypt.
כי אנשי מקנה היו. מכבר בשנים שעברו דבכלל מקנה כל בהמה ביתיות כמבואר להלן מ״ז י״ז סוסים וחמורים וגמלים. וזה לא היה לבזיון כמו רועי צאן ורצה יוסף למעט כל האפשר להבזות את אחיו ובית אביו בעיני פרעה לומר שעיקר תולדותם המה פחותי ערך ע״כ יאמר כי אנשי מקנה היו ובהמשך הזמן ירדו ממעמדם ונשארו רועי צאן
Because they are breeders of livestock - For many years now, generally, every domestic animal, as explained later on (47:17), includes horses and donkeys and camels. And it was not a disgrace like shepherds and Yosef wanted to minimise every possibility of disgracing his brothers and his father's house in the eyes of Pharaoh, by saying that the main part of their history/backstory was of little value and therefore he said that they were 'breeders of livestock', and in the course of time they would descend from their status and remain as shepherds
Therefore, Yosef first wanted them to call themselves shepherds as he knew this would be a point of contention in Egypt which would force Pharoah to move them to a place where they would receive little to no attention and thereby avoid any issue. In addition, since the concept of shepherding was seen as a blasphemous occupation in Egypt, Yosef suggested that they also call themselves breeders of livestock so that it implies they handle other domesticated animals that were not worshipped, to detract from their job as shepherds allowing them to slip more readily under the radar.
It is also worth noting the Rabbeinu Bachaye who says that the naming of both occupations served a dual purpose. By saying they were shepherds could imply they were employed by others, but by also saying they were cattleman it implies that there were wealthy in that it was a very profitable trade. Namely the gain from milk, wool etc as well as being not too labour intensive meaning they would not become engaged in dishonest and sinful pursuits. Secondly the reference to shepherds was also with one mind on the fact that this marked the beginning of the exile, and they wanted future generations to know despite living in a place where the country worshipped sheep, they chose an occupation which demonstrates the relative limitation and ungodly nature of such animals.
With this in mind we can understand the ensuing conversation. Yosef goes on to say that when Pharoah ask you about your occupation, you should answer that you are cattlemen (46:33-34). As he says there is a genuine concern that they would be ostracised as sheep were an Egyptian deity. Chizkuni notes that Yosef was worried that his brothers would likely be given senior roles in Pharoah's palace and they should specifically say they were cattleman so that it would avoid a situation where Yosef's detractors could use something against him to reduce his status.
However, when the brothers come face-to-face with Pharoah (47:3) they say they are shepherds. According to the Netziv this was a calculated response. He notes that rather than call themselves cattlemen they reverted to saying they were shepherds in order to preserve a sense of honour and to avoid any sort of boasting on their part. They were merely answering Pharoah's question as they heard it, and to answer that they were cattleman, would be perceived in a way in which they would appear as gloating before the king which would not reflect well. Rav Shimshon Raphael Hirsch says similarly, that Yoseph left to their discretion the possibility of saying "Cattleman", but they were not ashamed of their work and said openly: "Shepherds".
Pharoah's response (47:6) of putting them in charge of his livestock (שָׂרֵ֥י מִקְנֶ֖ה) is actually a point of contention amongst the commentaries. Rashi says expressly this is a reference to looking after his sheep. Whereas Ibn Ezra says it is a reference to horses and mules. Similarly, Chizkuni says that Pharoah was most interested in camels, mules and horses.