- Git notes
- Exercise 1: Create a repository
- Exercise 2: Merge a branch
- Exercise 3: Create a organization
- exercise 4: Wrong.
- exercise 4: retry
This documentation describes the exercise for git training
- create a new repository
- login to your github account account
https://github.com/ - On the left side repository click on new
- Fill in the following things
- Repository name: avengers
- Description: avengers example
- choose Public
- Initialize the repository with
- create a branch - feature release
- make a change to the readme file
- create a pull request
- merge into into the main branch
- Go to your repository
- go to the main and switch branch and enter feature release and click on the Create branch: feature release
- check that you are on the feature-release branch now
- Change something in the readme file by click on the pencil
- make some changes and go to the bottom
- With the commit changes. Write a description of what you changed and commit directly to the feature-release branch button
- Click the Commit changes button
- You now want to merge this change to the main branch
- Click on the Pull Requests
- We want to merge the feature-release branch into the main release. Check that it is now like this
- Give it some clear explanation and write something description. Click the Create Pull request
- You can now merge the pull request. Click on it
- Confirm the merge request
- Delete the feature-release branch. Click on it
- Check the results
- create an organization
- login to your github account account
https://github.com/ - On the top right side go to your profile and go to settings
- On the left go to organizations
- Select New organization
- select a Free account
- Set up your organization
- organization account name: superheroes-munnep
- Contact email: patrick.munne@hashicorp.com
- This organization belongs to: My personal account
- Complete the setup
- Confirm your login credentials
- Now you should have Your Organizations under your username on the top right side
- See an overview of your organization
- You have an organization
I had to do it from organization to personal and then back to organization. Below I did it the other way around
- create fork repository from avengers main to organization superheroes-munnep
- branch the new fork repository to a feature-release using git-cli
- make changes to the README.md
- create a merge to the avengers main repository
- delete the branch feature-release
- login to your github account account
https://github.com/ - Go to the repository munnep/avengers main branch
- On the top right side click on Fork
- Select superheroes-munnep
- Now we have a new repository called superheroes-munnep/avengers
- We need to create a new branch called feature-release
Click on main -> Switch branch -> feature-release -> click Create branch - feature-release
- From github get the URL to clone the repository. Click on the Code button to see it
- Go to your terminal and a directory where you want to clone the git repository to your local machine
- Clone it with the following command and switch to to feature release
git clone https://github.com/superheroes-munnep/avengers.git
cd avengers
git checkout feature-release
- Make some changes to the README.md
- Just an example
[patrick:~/git/avengers] feature-release ± vi README.md
[patrick:~/git/avengers] feature-release(+2/-0) 32s ± cat README.md
# avengers
avengers example
We just made this change in the feature release branch
This has been added by a change which was done on a feature-release branch under a fork in a different organization
- Add the files to git for change and commit them locally
git add .
git commit -am "made a change exercise 4"
git push
note: If you get an error with git push about your account saying you need a personal access token then take the steps described by this link
13. Go back to github and the repository superheroes-munnep/avengers. You should see the change you made under branch feature-release
14. Merge superheroes-munnep/avengers branch feature-release to the repository avengers branch main
15. klik on pull requests
16. click new pull request
17. Check that you merge the branch feature release from superheroes-munnep/avengers to munnep/avengers
18. click the Create pull request
19. give it a correct name and description and click create pull request
20. Click the Merge pull request
21. Click Confirm Merge
22. Click delete branch
23. You should now see your changes on the main branch of the munnep/avengers repository
- create fork repository from organization superheroes-munnep repository justice-league
- branch the new fork repository to a feature-release using git-cli
- make changes to the README.md
- create a merge to the superheroes-munnep main repository
- delete the branch feature-release
- login to your github account account
https://github.com/ - New repository
- fork to myself as a developer
- create a feature release branch
- use local git commands
- clone to local repository
git clone https://github.com/munnep/justice-league.git
- go to directory
cd justice-league
- switch to branch feature-release
git checkout feature-release
- add the changes
git add .
- commit the changes
git commit -am "changes made"
- push the changes
git push
- changes should be visable in the UI