Now, after that long tangent about whether or not communism is an "ideology" and why whether we define it as an ideology matters, what does all of that have to do with whether or not patriotism is compatible with communism.
With the context and understanding I laid out above about how what makes something good/bad strategy is very dependent on the specific situation you are discussing, we can instead ask the question, "How is patriotism used/how does it manifest in different contexts, and what ends does that serve." Our common point of reference for where our understanding of what patriotism is comes from nationalist movements that grew in nations which became significant geopolitical entities through a legacy of colonialism and capitalist imperialism. These national projects have an identity that is intertwined with that colonial/imperialist legacy, and which is therefore difficult to separate from that legacy. This means that organizing around pride over that national identity will be inherently exclusionary to any groups who were victims of the legacy that you are celebrating and taking pride in. And indeed because of that context the way patriotism is often invoked is as a way for people in power who benefit from that legacy (as well as benefitting from the ongoing power/privilege that a given national project grants them) to deflect criticism or manufacture support for the past and ongoing harm caused by that national project. It does this by conflating criticism of the nation with criticism of an individual's identity, and by conflating "enemies of the nation" with "enemies of the people."
For those reasons, patriotism and national pride in the context of a colonial/imperialist nation is almost exclusively a tool for reactionaries. Denouncing and/or condemning national identity can make it harder to reach out to and organize with people who identify strongly with their nationality, and this is the argument Patsocs will use to say that you should embrace patriotism or else you are pushing away potential allies who will be turned off by an anti-patriotic message. But like I laid out above, the flipside to that argument is that the more you embrace patriotism the more you push away and exclude groups who were victims of your nation's legacy just to be more palatable to people who identify with and benefitted from that legacy in some way. And ultimately, when you are organizing you can eventually bring people around to supporting a more inclusive position through education and political outreach. But if you compromise on issues of systematic justice just to make it slightly easier to organize with people who have reactionary views with regards to patriotism, then ultimately you are creating an organization that marginalized groups on the other side of that national legacy will never feel safe participating in.
But national identity in the context of a colonized/formerly colonized nation takes on entirely different characteristics. In the context of colonization, national identity is used by the colonizing group to create mythologies about the cultural and racial deficiencies of the people who are being colonized in order to justify that occupation. Entire systems of schooling will be set up in occupied colonies to reinforce the colonist's world view, teaching children that their backwards and savage culture was hopelessly stuck in the stone ages until the more technologically advanced and philosophically enlightened colonizers came along to lift them out of the mud and be given the chance to serve a cause greater than themselves. That the colonizers graciously bestowed upon them colonial governments that were so much more sophisticated than the barbarism their people were accustomed to, that the colonizers were very magnanimous for giving structure and order to a savage and backward group of people who were too mentally or culturally deficient to look after themselves, and that in order to be a good colonial subject they must denounce their backwards culture, traditions, language, style of dress, values, beliefs, and mimic the culture of the colonizer instead.
The patterns of life imposed onto colonized people and the learned inferiority that is imposed and enforced by colonial rule and decades of social conditioning and indoctrination is an essential component for how colonialism and neo-colonialism reproduces itself an maintains political power over its colonized subjects. Forcing colonized people to internalize some version of this ideological framework is a powerful tool of psychological warfare. Dissent and resistance to colonial rule becomes much more rare if the colonized group believes this mythology, is made to feel shame about their heritage and culture, believes that they are worthy of being classified as a second class citizen in their own home, believes that they are better off under colonial rule, and so on. And this learned shame and learned inferiority can often be turned inward against a person's own family or community, causing people who have bought into this mythology to lash out against people in their communities who attempt to preserve their culture and their heritage with feelings of anger because "those kinds of backwards people who refuse to get with the times are the reason why we are looked down on as uncivilized savages."
This kind of social conditioning and cultural genocide is a powerful mechanism of control for colonial/neo-colonial governments. And the psychological/generational trauma inflicted as a result of this institutionalized oppression is devastating and demoralizing. And this context is what gives nationalism and national pride of a colonized people completely different characteristics. Creating a counter narrative in opposition to the mythology imposed by the colonizer can be incredibly powerful. It allows you proudly say that the self-serving mythology of the colonizer is a lie, that we are not culturally deficient savages that they wish to portray us as while they plunder our country and exploit our labor. That we have a heritage and history we can be proud of, that we have a strong community and shared struggle, and that we deserve to reclaim our own autonomy and govern ourselves instead of being ruled over by a colonial empire from half a world away.
In that context, nationalism and rallying people around national pride/national identity can be an incredibly powerful psychological tool for healing the morale of people who have been systematically oppressed and traumatized. It is a salve for a wounded and broken spirit to be told that you aren't deficient, that you do deserve better, and that all of the people who share in the community you belong to are willing help each other out to get through this struggle that we all find ourselves in so that we can all be free. Nationalism/patriotism in that context is a very powerful, and arguably necessary, force of liberation. And like others have commented, if you want to see this topic addressed much more thoroughly then you should read Fanon.
Now, a national liberation struggle is not necessarily going to result in communism. Whether a national liberation struggle pursues communism as its end goal depends at least in part on who is organizing and leading that struggle. But a national liberation struggle where nationalism is used as an organizing principle is certainly not incompatible with working towards communism, and in a colonized nation it is arguably a necessary first step and possibly the most effective organizing strategy available based on that context.
When people say that nationalism/patriotism is incompatible with communism, usually the point they're trying to make is that it is not possible to achieve communism in one country. That capitalism is a global system that imposes itself on the world via imperialism backed by the might of military empires. Therefore it can never be sufficient to overthrow capitalism in a single nation, because as long as the rest of the world is still capitalist your nation will be isolated, strangled, starved, and attacked until your liberation project falls apart and is dismantled so that it can be replaced with a capitalist government once again. Since a communist project cannot survive against capitalist onslaught in an isolated nation, any strategy for pursuing communism must involve an international component and support for liberation struggles around the world. But what this argument misses is that internationalism is not the opposite of nationalism. There's no reason why a national liberation struggle would be incompatible with international solidarity with other liberation struggles around the world. In fact, I would argue that it's fairly evident that you are unable to provide any effective support for international struggles until you are able to organize around resolving struggles at home first, and that national liberation struggles therefore create more opportunities for international solidarity. Which is just the basic idea of "It's impossible to fill another man's glass if your own pitcher is empty." In order to give solidarity to others you must first secure your own autonomy.
It's certainly true that the variety of nationalism/patriotism practiced in the imperial/colonial nations would certainly put up barriers to international solidarity, particularly with respect to people and nations who have suffered directly from that legacy. But that's why it's important to not take an analysis that's based on a specific frame of reference and clumsily apply that analysis in a different context by assuming that those conclusions are universal.
Now, after that long tangent about whether or not communism is an "ideology" and why whether we define it as an ideology matters, what does all of that have to do with whether or not patriotism is compatible with communism.
With the context and understanding I laid out above about how what makes something good/bad strategy is very dependent on the specific situation you are discussing, we can instead ask the question, "How is patriotism used/how does it manifest in different contexts, and what ends does that serve." Our common point of reference for where our understanding of what patriotism is comes from nationalist movements that grew in nations which became significant geopolitical entities through a legacy of colonialism and capitalist imperialism. These national projects have an identity that is intertwined with that colonial/imperialist legacy, and which is therefore difficult to separate from that legacy. This means that organizing around pride over that national identity will be inherently exclusionary to any groups who were victims of the legacy that you are celebrating and taking pride in. And indeed because of that context the way patriotism is often invoked is as a way for people in power who benefit from that legacy (as well as benefitting from the ongoing power/privilege that a given national project grants them) to deflect criticism or manufacture support for the past and ongoing harm caused by that national project. It does this by conflating criticism of the nation with criticism of an individual's identity, and by conflating "enemies of the nation" with "enemies of the people."
For those reasons, patriotism and national pride in the context of a colonial/imperialist nation is almost exclusively a tool for reactionaries. Denouncing and/or condemning national identity can make it harder to reach out to and organize with people who identify strongly with their nationality, and this is the argument Patsocs will use to say that you should embrace patriotism or else you are pushing away potential allies who will be turned off by an anti-patriotic message. But like I laid out above, the flipside to that argument is that the more you embrace patriotism the more you push away and exclude groups who were victims of your nation's legacy just to be more palatable to people who identify with and benefitted from that legacy in some way. And ultimately, when you are organizing you can eventually bring people around to supporting a more inclusive position through education and political outreach. But if you compromise on issues of systematic justice just to make it slightly easier to organize with people who have reactionary views with regards to patriotism, then ultimately you are creating an organization that marginalized groups on the other side of that national legacy will never feel safe participating in.
But national identity in the context of a colonized/formerly colonized nation takes on entirely different characteristics. In the context of colonization, national identity is used by the colonizing group to create mythologies about the cultural and racial deficiencies of the people who are being colonized in order to justify that occupation. Entire systems of schooling will be set up in occupied colonies to reinforce the colonist's world view, teaching children that their backwards and savage culture was hopelessly stuck in the stone ages until the more technologically advanced and philosophically enlightened colonizers came along to lift them out of the mud and be given the chance to serve a cause greater than themselves. That the colonizers graciously bestowed upon them colonial governments that were so much more sophisticated than the barbarism their people were accustomed to, that the colonizers were very magnanimous for giving structure and order to a savage and backward group of people who were too mentally or culturally deficient to look after themselves, and that in order to be a good colonial subject they must denounce their backwards culture, traditions, language, style of dress, values, beliefs, and mimic the culture of the colonizer instead.
The patterns of life imposed onto colonized people and the learned inferiority that is imposed and enforced by colonial rule and decades of social conditioning and indoctrination is an essential component for how colonialism and neo-colonialism reproduces itself an maintains political power over its colonized subjects. Forcing colonized people to internalize some version of this ideological framework is a powerful tool of psychological warfare. Dissent and resistance to colonial rule becomes much more rare if the colonized group believes this mythology, is made to feel shame about their heritage and culture, believes that they are worthy of being classified as a second class citizen in their own home, believes that they are better off under colonial rule, and so on. And this learned shame and learned inferiority can often be turned inward against a person's own family or community, causing people who have bought into this mythology to lash out against people in their communities who attempt to preserve their culture and their heritage with feelings of anger because "those kinds of backwards people who refuse to get with the times are the reason why we are looked down on as uncivilized savages."
This kind of social conditioning and cultural genocide is a powerful mechanism of control for colonial/neo-colonial governments. And the psychological/generational trauma inflicted as a result of this institutionalized oppression is devastating and demoralizing. And this context is what gives nationalism and national pride of a colonized people completely different characteristics. Creating a counter narrative in opposition to the mythology imposed by the colonizer can be incredibly powerful. It allows you proudly say that the self-serving mythology of the colonizer is a lie, that we are not culturally deficient savages that they wish to portray us as while they plunder our country and exploit our labor. That we have a heritage and history we can be proud of, that we have a strong community and shared struggle, and that we deserve to reclaim our own autonomy and govern ourselves instead of being ruled over by a colonial empire from half a world away.
In that context, nationalism and rallying people around national pride/national identity can be an incredibly powerful psychological tool for healing the morale of people who have been systematically oppressed and traumatized. It is a salve for a wounded and broken spirit to be told that you aren't deficient, that you do deserve better, and that all of the people who share in the community you belong to are willing help each other out to get through this struggle that we all find ourselves in so that we can all be free. Nationalism/patriotism in that context is a very powerful, and arguably necessary, force of liberation. And like others have commented, if you want to see this topic addressed much more thoroughly then you should read Fanon.
Now, a national liberation struggle is not necessarily going to result in communism. Whether a national liberation struggle pursues communism as its end goal depends at least in part on who is organizing and leading that struggle. But a national liberation struggle where nationalism is used as an organizing principle is certainly not incompatible with working towards communism, and in a colonized nation it is arguably a necessary first step and possibly the most effective organizing strategy available based on that context.
When people say that nationalism/patriotism is incompatible with communism, usually the point they're trying to make is that it is not possible to achieve communism in one country. That capitalism is a global system that imposes itself on the world via imperialism backed by the might of military empires. Therefore it can never be sufficient to overthrow capitalism in a single nation, because as long as the rest of the world is still capitalist your nation will be isolated, strangled, starved, and attacked until your liberation project falls apart and is dismantled so that it can be replaced with a capitalist government once again. Since a communist project cannot survive against capitalist onslaught in an isolated nation, any strategy for pursuing communism must involve an international component and support for liberation struggles around the world. But what this argument misses is that internationalism is not the opposite of nationalism. There's no reason why a national liberation struggle would be incompatible with international solidarity with other liberation struggles around the world. In fact, I would argue that it's fairly evident that you are unable to provide any effective support for international struggles until you are able to organize around resolving struggles at home first, and that national liberation struggles therefore create more opportunities for international solidarity. Which is just the basic idea of "It's impossible to fill another man's glass if your own pitcher is empty." In order to give solidarity to others you must first secure your own autonomy.
It's certainly true that the variety of nationalism/patriotism practiced in the imperial/colonial nations would certainly put up barriers to international solidarity, particularly with respect to people and nations who have suffered directly from that legacy. But that's why it's important to not take an analysis that's based on a specific frame of reference and clumsily apply that analysis in a different context by assuming that those conclusions are universal.