What object size can we prevent from colliding with the earth?

I was thinking hey what if another star or another planet like mars

Mars is only slightly smaller than Earth, but not enough to matter in this case. So if you don't have something with which to push the Earth right now, then you can rest assured you won't be able to move around other planets.

Try to find out how much mass a typical planet like Earth or Mars has. Then, find out how fast such planets move around, say for example, the Sun. Then use the kinetic energy formula you learned in your high school physics classes to see what is the total kinetic energy from that object. To find out how big or small that number is, then you should compare it with something else, say for example the total amount of energy produced by the Sun over (for example) one year. Hint: you'll be disappointed at the requirements for moving big, planet-sized bodies. If there's one coming your way, all you can do is to step aside.

another planet like mars or even from another solar system magically exited their own orbit

This isn't Harry Potter or Doctor Strange or Superman. This is reality.

I searched online and I noticed that there are multiple technologies currently available or being developed to deflect or change the trajectory of asteroids from hitting the earth.

I'd like to know about those. Because as far as I know there are no technologies available to deflect asteroid trajectories.

how big of an asteroid do we have the power of deflecting/destroying/moving?

It depends on the lead time, the composition and the actual trajectory of the asteroid. If you're decades ahead then you might have a good chance. If you've only have say three weeks then, well, forget about it.

if there was a giant planet coming towards earth,

Then forget about it. Do even know what is the mass of the Earth? You can't move the Earth, let alone an imagined giant planet.

if there was a giant planet coming towards earth, we obviously can not move or change the course of the planet,

What would be interesting here is for you to explain why you think that way. I suspect that you already know more than you think you know, beyond your haze of giant planets and collisions. So the job really is to separate the reality from the fiction.

do we have enough power to change the speed of the earth a little bit

I don't know. Tell us how much is "a little bit" and we'll be able to give you an yes/no answer to that question.

What can we really do against a big planet coming to kill us?

Right now? Nothing. 100 years from now? Nothing. 1000 years from now? Meh... I'm still going to go with "no".

/r/Physics Thread