Introduction au gestionnaire de version GIT
WP Meetup Geneva
- Slides : https://slides.com/maximeculea/meetup-wp-geneve-introduction-git
- YouTube vidéo : coming soon
WP Meetup Paris
- Slides : https://slides.com/maximeculea/meetup-wordpress-git
- YouTube vidéo : https://www.youtube.com/watch?v=-VFoqwbQSM8
General git workflow
- add a file from IDE :
maxime.php
- add it to git :
git add maxime.php
or all files withgit add .
- edit the file then commit changes :
git commit -m "my first commit"
- push them :
git push origin master
Git Conflict
- create a new branch from master :
git checkout -b evol/1
- edit the file :
<!DOCTYPE html>
<html>
<body class="toto">
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
- push the changes :
git push origin evol/1
- create from master a other one :
git checkout -b evol/2
- edit the file :
<!DOCTYPE html>
<html>
<body class="toto titi">
<h1><?php the_title(); ?></h1>
<p>My first paragraph.</p>
</body>
</html>
- push changes :
git push origin evol/2
- we can change branches (content) as we want :
git checkout evol/1
- on server, only get the modifications :
git fetch -a
- to apply the new modifications :
git pull -f
- finally merge the two branches on master :
- go on master :
git checkout master
- merge branches :
git merge evol/1
andgit merge evol/2
- go on master :
- it results into a conflict :
- edit the final modification into the file
- stage changes :
git add .
- then commit them :
git commit -m "Resolved merge conflict by incorporating both suggestions."