1

I'm working on laravel project and try to use github to share code with my colleagues. I can setup project use git clone command. But once my colleague update project and push server then my code already out of date. So how can get that new update to overwrite my existing using git command.Any advice or guidance on this would be greatly appreciated, Thanks

Alexpandiyan Chokkan
  • 1,025
  • 1
  • 10
  • 30
joenpc npcsolution
  • 737
  • 4
  • 11
  • 25

1 Answers1

2

Rather than overwrite, the best practice is to replay ("rebase") your local commits (that you do not have pushed yet) on top of the remote (updated) branch.

With Git 2.6+, type:

git config --global pull.rebase true
git config --global rebase.autoStash true

From there, a simple git pull will be enough.
You can then test your local code on top of what your colleagues have already pushed.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250