- Fork given repository
- Go to your github account and find the forked repository
- Clone/Pull repository
- Create your branch. Name it like ‘feature/name-surname’
- Switch to that branch.
- Create a folder with your name like name-surname.
- Go to that folder. All changes you make will be inside this folder.
- Create a helloWorld.txt file with the text ‘Hello World!’
- Commit that file with message ‘My first commit’
- Push this code to repo
- Create a branch from your feature branch called conflict/name-surname
- Go to your conflict branch ( conflict/name-surname )
- Change helloWorld.txt file contents to ‘Hello World from merge-conflict branch!’
- Commit and push your changes
- Go back to your feature branch ( feature/name-surname )
- Change the contents of helloWorld.txt file to ‘Hello from feature branch!’
- Commit and push your changes
- Merge merge-conflict brach into your feature branch ( feature/name-surname )
- Resolve conflicts with your favourite editor. Your finished helloWorld.txt file contents should be:
Hello from feature branch!
and
Hello from merge-conflict branch!
after successful merge conflict - Commit and push your resolved merge conflict
- You should have your feature branch with the helloWorld.txt file and it’s contents:
Hello from feature branch!
and
Hello from merge-conflict branch!
after successful merge conflict - Go to repo page and check your commit history to see how it looks visually and that all steps were done successfully.
- Create a pull Request to merge your feature branch to master
- git status - shows the current status and relavent data
- git add pathToFile - moves specified changes to staging area
- git add . - moves all current changes to staging area
- git commit -m "message" - moves changes from staging area to commit history
- git push - updates remote repository with commit history from your local repository
- git push --set-upstream origin branchName - creates an istance of your local branch in remote
- git pull - updates your local repository with commit history from remote repository
- git branch branchName - creates a new branch in local repository
- git checkout branchName/hash - moves to the specified branch or commit
- git merge branchName - merge specified branch commit history into current branch