If you have local changes in your Git repo and pull in new changes from your remote repository, Git will per default create a merge commit for the pulled changes. This can clutter your history with unnecessary commits.
To rebase your local changes on top of the pulled changes, you can use:
git pull --rebase
To activate this for all new branches.
git config --global branch.autosetuprebase always
To update existing branches in your Git repo use the command:
git config branch.<name>.rebase true
Not everyone likes rebase. Here is a little summary why Linus Torvalds doesn’t like rebasing: http://kerneltrap.org/Linux/Git_Management.
But if I have local changes and i try to use git pull, it says you can’t, first commit your changes to local repository;
Is that a normal behavior? because having this you described problem will never occur to me;
@Ans: This setting will prevent that you get a merge commit on top of your changes with the changed pulled in from repo. You will have one commit less in this case.