Having an H-1B Visa does not mean you're required to file U.S. taxes. You are considered a U.S. resident for tax purposes only if you meet the substantial presence test for the calendar year, beginning on the first day you were in the United States. You are not considered to be present in the United States if you are an "exempt individual."
If you meet the substantial presence test and have been in the U.S. on an H-1B visa for the entire calendar year, you are considered a full-year resident for U.S. tax purposes.
If you fail the substantial presence test, you are considered a nonresident alien unless you qualify for and make a special election.
As a nonresident alien, you must file a tax return for each year spent in the U.S. if you have any income subject to U.S. income tax. If you are married, you and your spouse must file separate returns: joint returns are not allowed.
You can make a special election [IRC Sec. 7701(b)(4)] to be treated as a resident alien from your arrival date if you satisfy the following tests:
You would not otherwise be considered a resident alien for the year,
You were not a resident alien at any time during the prior tax year,
You are considered to be a resident alien under the substantial presence test for the following year,
You were present in the United States during the election year for 31 consecutive days,
The days you were present in the U.S. account for 75% or more of the total days between the beginning of the period of 31 consecutive days and December 31.
You may also elect to file a joint resident return with your spouse and to be treated as a U.S. resident for the entire year [IRC Sec. 6013(g)]. Under this election, you can claim the standard deduction and other tax benefits available to U.S. citizens and residents. Still, you are your worldwide income will be subject to U.S. taxes for the entire calendar year. The Foreign Tax Credit can generally be claimed against foreign taxes paid on income from foreign sources to eliminate double taxation.
If you meet the substantial presence test but wish to utilize the Tiebreaker Rule (claiming treaty benefits and closer ties to another country):
You can claim closer ties for the entire year or part of the year.
If you claim for the whole year (please note that if you live in the U.S., this is not feasible), you would file a NonResident Return + Form 8833.
If claiming for part of the year, you would file a Dual Status Return (Form 1040 for the partial year, Form 1040NR for the partial year + Form 8833).
Note: the Tiebreaker Rule, in general, is a coin flip and can open you up for scrutiny by the IRS. For example, this is difficult to substantiate if you use the Tiebreaker Rule and also wish to claim exemptions for non-U.S. dependent children.