Smartness? Not really
Whenever you started a new project in Xcode and making the first (a.k.a. "initial") commit to your new Git repository you will end up with the double initial commit.
You might be frustrated thinking on why there are two "initial" commits when you've done only one?
This is reasonable frustration but it is how things work when you check "Create Git repository" checkbox in Xcode New -> Project... wizard.
Xcode automatically fires initial commit to your new local git repo once project creation wizard finishes.
Then you will tie remote origin to your project (Source Control -> Configure) make the major initial setup (adding .gitignore) and press ⌘⌥C to commit. In the commit dialog you will check the files you're commiting and will proudly write Initial Commit in commit message box.
Then you fire Push and ... end up with double "Initial Commit".
Either leave "Create Git repository" checkbox unchecked when creating the project or name your first commit somewhat other than "Initial Commit" or you will get the dupe in your repo.
For the first case perform
git add .
git commit -m "Initial commit". Then restart Xcode so you will now be able to tie remote origin and push.