You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pull latest changes from upstream remote repository
git pull upstream master
Part 2: Make your changes
Create a new branch with your name
Edit the git_masters.json file
Follow the format of my entry in students
Name
Your perferred language
Add the file to the staging area
Commit the file to the local repository
Merge changes into the main branch
Push changes to the remote repository
Part 3: Dealing with merge conflicts
Sometimes merge conflics happen and you have to resolve them.
Merge the branch joe into the main branch
Git will tell you that there is a merge conflict
Open the file with the merge conflict, You will see the following
<<<<<<< HEAD
Your changes
=======
Joe's changes
>>>>>>> joe
The between <<<<<<< HEAD and ======= are the changes in the current (main) branch
The between ======= and >>>>>>> joe are the changes in the joe branch
Delete joe's changes and keep your changes by deleting between ======= and >>>>>>> joe
Then delete the lines <<<<<<< HEAD, ======= and >>>>>>> joe
Commit the changes
Push changes to the remote repository
Part 3: Create a pull request
Log into github
Navigate to the upstream remote repository
Create a pull request
Wait for approval
Git Syntax
Basic Commands
Command
Syntax
Description
git clone
git clone <repository_url>
Makes a copy of a remote repository onto your local machine.
git pull
git pull <remote> <branch>
Fetch & merges changes from the remote repository to your local repository.
git push
git push <remote> <branch>
Copies & merges changes from your local repository to the remote repository.
git add
git add <file_name>
Adds changes made in the current working directory to the Index (Staging).
git commit
git commit -m "<commit_message>" git commit -a
Commits changes to the local repository. -a attribute specifies to commit changes straight from working directory to repository. Ignnores untracked files.
Branching Commands
Command
Syntax
Description
git branch
git branch
Lists all branches in the local repository.
git branch
git branch <branch_name>
Creates a new branch in the local repository.
git checkout
git checkout <branch_name>
Shows the specified branch or commit in the working directory.
git branch -d
git branch -d <branch_name>
Deletes the specified branch in the local repository.
git merge
git merge <branch_name>
Merges the specified branch into the current branch.
git rebase
git rebase <branch_name>
Replays commits from the current branch on top of the specified branch.
More Commands
Command
Syntax
Description
git status
git status
Shows the status of the working directory and staging area.
git log
git log
Shows the commit history for the current branch.
git diff
git diff
Shows the difference between the working directory and the staging area.
Moves head to the specified commit. --soft keeps changes after specified commit in index --mixed keeps changes after specified commit only in working directory --hard discards all changes after specified commit