Skip to content

Latest commit

 

History

History
79 lines (56 loc) · 2.56 KB

git.md

File metadata and controls

79 lines (56 loc) · 2.56 KB

Git

Install git on Ubuntu 22.04

First, use the apt package management tools to update your local package index.

sudo apt update

With the update complete, you can install Git:

sudo apt install git

You can confirm that you have installed Git correctly by running the following command.

git --version
# Output
git version 2.34.1

Setting Up Git

You should configure Git so that the generated commit messages you make will contain your correct information.

Configuration can be achieved by using the git config command.
Specifically, you need to provide your name and email address because Git embeds this information into each commit you do.
You can add this information by typing:

git config --global user.name "Your Name"
git config --global user.email "youremail@domain.com"

You can display all the configuration items that have been set by typing:

git config --list
# Output
user.name=Your Name
user.email=youremail@domain.com
...

Instructions taken from DigitalOcean Git Tutorial

You must also configure your global .gitignore to exclude the .idea hidden directory generated by PhpStorm on each project.
You can do so by typing :

echo ".idea" >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global

How to get the .git history of an installed vendor

If you wish to work on a bundle inside a project, we advise getting his git sources directly inside the project, rather than cloning it and open in a standalone context. That way you can directly test your changes in a real project situation, commit and push these changes to the bundle repository remote.

Firstly you must require the bundle you want to work on the "normal" way.

composer require --dev smartbooster/standard-bundle

Then you have to reinstall the bundle with the option --prefer-source

# We use the --prefer-source option with the reinstall command because that way the option only target the bundle. 
# If did it at the require step it will also fetch the git history of all the requirements of the bundle which we don't need
# and can take some times to download.
composer reinstall smartbooster/standard-bundle --prefer-source

After that, you can either open the vendor folder on a new ide project instance or add a second remote dedicated to the bundle repository on your current parent project.

To add a second remote on phpstorm, got to Git -> Manage Remotes ... then add with "+".