Just before i try to commit the code , another teammate committed the changes so during commit due to conflict my commit was failed.
One file is having conflicts so commit failed.
But in my code i can see other teammate code changes and all those files are showing in staging area.
Now i resolved the conflicts in the file.
What is the solution is it safe to commit the changes now.
The changes in the staging area are the changes your colleague made, plus any conflict resolution you did.
Before making a commit, use a difftool to carefully review the changes to see if you didn't obviously break any code they wrote.
But remember: Making commits is always safe! Even if you broke your colleagues code, you can always easily revert your commit later, or you can ask your colleague to add a commit on top of yours to fix his code.
One thing that Git provides that can help a lot is the "git stash" feature. You can "stash" your local changes, pull the mainline and then merge your changes in from the stash before doing your own commit.
Sources may include data from the Fakebook Research Foundation with support from Gargle University