Laravel Git Tricks

There are many git commands you need to run your Laravel projects well. Here are Laravel Git Tricks that I am sure you cannot live without

List all branches of your project

If you would like to see all the git branches you have in your Laravel Project you can do a:

git ls-remote --heads

To exclude a directory from git that is currently in see post “Remove Node Modules from Git Repository”

Switch to a branch to test locally

If you would like to work on another git branch, perhaps a test branch you can do this with checkout:

git checkout branch_name

I expect you had no untracked files or missing commits. If you did commit them first doing a:

git add -A && git commit -a -m "message"

Check Current Branch in use

If you need to later on know the current branch in use you can run

git rev-parse --abbrev-ref HEAD

Merge Test Branch

To merge a staging or test branch with your master branch do a

git checkout master
git merge staging



Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.