Giter VIP home page Giter VIP logo

workshop-git's Introduction

Special guests: Chip and Dale

⬅ Version FR

In a team of 2 developers, follow the instructions, each choosing their role! Left column: Chip. Right column: Dale. In this workshop, you will learn how to collaborate using Git and GitHub, how to manage file conflicts, and how to version your code.

Chip

Create a new empty directory named wild-project on your workstation. Create a new empty public repository on GitHub called wild-project on your profile. (No README.md generation!!)

Dale

Watch what Chip does and pay attention.

Chip

Inside the new folder wild-project located locally on your computer, follow the commands listed on GitHub in ...or create a new repository on the command line.

Be sure you checked SSH option, not HTTPS. {: .alert-warning}

Dale

Explain to Chip what he is doing in each step.

These commands

Git setup commands

Chip

Give the link to the repository to Dale, and understand how to do clone it together on Dale's computer.

Dale

Clone Chip's newly created repository by renaming the local target directory "wild-dale".
Be careful, use :

git clone url_of_the_new_repository wild-dale

Everyone

Open the project directory in your Code Editor. {: .alert-info}

Chip

Modify the README.md file by typing:

# wild-project

How to install this project?

All we have to do for now is clone it.

Dale

Watch what Chip does and pay attention.

Chip

Create the file another_file.html in the project directory.
Add a comment inside the file:

<!-- type your comment here -->

Dale

Create the file not_same_file.html in the project folder.
Open the file and add a comment inside as well, it doesn't matter if it's the same or different.

Chip

Look at what Dale is doing, try to understand what is happening in each step and what the result is.

Dale

Create the file secret_file.html containing:

<!-- Must not be shared on GitHub because this is the password I use for gmail,
facebook, my laptop, and if I could, I would use the same as pin for my cell
phone -->

Execute:

git status

Ignore the file secret_file.html by creating a .gitignore file (click here for more information) and adding the necessary instructions to it.

Chip

Execute:

git status

Dale

Execute:

git status

The .gitignore file should appear.

Everyone

git add .
git status
git commit -m "Change me"

Replace "Change me" by an explicit message explaining what you've done, there are no limits, and you can press enter as long as you haven't closed the quotes. {: .alert-info}

Chip

Start pushing first:

git push

Dale

Same for you, after Chip:

git push

Chip

Everything went well for you.

Dale

You've got an error message: what does the message say?

Chip

Since you're the owner of the repository, you have to allow Dale to work on it...
Navigate to “Settings” > “Collaborators and team” and add Dale as a collaborator.

Dale

You have to accept the invitation you should have received is in your mailbox. Then try again to push your commit to the online repository:

git push

Chip

As "Risk Ranger", help Dale.

Dale

You've got another error message! What does the message say?
Find the solution without searching the internet, just by reading the message in the console.

If you're really stuck, call your trainer for help! {: .alert-info}

Once you fixed the problem, you can finally push:

git push

Together

Check the update on GitHub. The secret_file.html file: is it there? {: .alert-info}

Chip

Do a git pull to get last changes made by Dale.
Then create a new branch from the current one:

git branch chip_branch
git switch chip_branch

Or directly:

git switch -c chip_branch

Dale

Follow the same instructions as Chip, and create a new branch dale_branch.

Chip

Create a same_file.html file and type a comment, i.e.:

<!-- type your comment here -->

Dale

Create a `same_file.html`` file and also type a comment inside it, but not the same as Chip!

Everyone

git add .
git status
git commit -m "Change me"

Chip

Publish your branch on GitHub using:

git push origin chip_branch

Dale

Publish your branch on GitHub using:

git push origin dale_branch

Chip

Create a pull request on GitHub from your branch chip_branch to main (Be careful with the direction).

Check if “able to merge” is displayed. Add a description: “Explain what you modified and how to test it”.

Dale

Watch what Chip is doing, and do the same with your branch (dale_branch to main)

Chip

Look at what Dale is doing and help him if needed.

Dale

Go on GitHub and go to your pull request.
Check if everything looks good and then click on the “Merge pull request” button.

🥳 Good Job ! You just successfully merge your first branch ! Now, you can see your work on the main branch. {: .alert-info}

Chip

Follow the same steps as Dale to validate your pull request and be able to merge your branch.

Damn ! There is a conflict ! You can see the message : “This branch has conflicts that must be resolved”. {: .alert-warning}

Dale

Look at what Chip does.

Watch this together

<iframe width="560" height="315" style="display:block; margin:auto" src="https://www.youtube.com/embed/JtIX3HJKwfo" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Chip

Instead of resolving the conflicts on GitHub like it is shown in the video, do it locally in your code editor.

On GitHub click on "command line instructions" as shown in the next image and follow the instructions. Don't forget to do some git status between every step and discuss about it with Dale.

link to command line instructions

Dale

Look at what Chip is doing and help if needed (A second developper won't always be here to resolve the conflicts with you, so take the benefit of it !)

Chip

Now that there is no more conflicts, go back to the pull request on GitHub, check if everything is good and click on the “Merge pull request” button.

Dale

Watch what Chip does and help if needed.

Together

You successfully resolved a merge conflict in a pull request, congratulations! 🥳 {: .alert-info}

workshop-git's People

Contributors

ashleighmorehattia avatar aurelienbarbier avatar comicscrip avatar davidmc971 avatar francoisdoussin avatar guillaumebdx avatar margauxdf avatar rocambille avatar sblondeau avatar

Watchers

 avatar  avatar  avatar  avatar

workshop-git's Issues

Merge the FR version (atelier-git) into here (workshop-git)?

Hi all,

I saw on Slack that you discussed whether to put the French version of the workshop into this repo as well or not and how to do it, therefore I open this issue now.

From what I picked up, we could:

  1. Keep the French version in a separate repo and mirror all changes except localized content by hand.
  2. Work out a solution like done in this workshop (source) as mentioned by @AurelienBarbier.
  3. Add an index-fr.html with static anchors as a basic alternative as mentioned by @rocambille.

@AurelienBarbier, @sblondeau, @rocambille, @FrancoisDoussin and others:
Let me know what you think, I am also happy to help with it, just need someone speaking French for a review of a resulting PR.

Best regards,
David

liens

Bonjour, si les liens vers la doc pouvaient s'ouvrir dans une nouvelle fenêtre de manière automatique, ce serait super !

Merci

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.