- Fork this repository
- Click on clone or download and then 'copy to clipboard'
- Open git bash in a folder
- Type
git clone
and hitShift + Ins
- After modifying files, git bash into '.../Hackfest18'
git diff
to show file differences not yet stagedgit add [file]
to stage the file before committinggit diff --staged
to show file differences between staging and the last file versiongit reset [file]
to unstage the file, but preserve its contentsgit commit -m "[descriptive message about the commit]"
to permanently commit the file into version history
- For experimental changes, it is advisable to open a new branch of the repository as follows
git branch
lists all local branches in the current repositorygit branch [branch-name]
creates a new branchgit checkout [branch-name]
switches to the specified branch and updates the working directorygit merge [branch]
combines the specified branch's history into the current branchgit branch -d [branch-name]
deletes the specified branch
- To update your fork on GitHub with the recent changes, do the following
- Go to your fork on GitHub
- Click on clone or download and then 'copy to clipboard'
- Open git bash in the local repository folder and type the following
git remote
lists all the aliases.- If you do not see an alias called origin, follow the next step
git remote add origin
and hitShift + Ins
(one-time process)git push origin [branch-name]
pushes the branch to the remote repositorygit push origin master
pushes your latest changes into the master branch of your fork
- To update the changes to the original repository, do the following
- Go to your fork
- If you see the message 'Able to merge', go ahead and click on 'Pull request'
- Otherwise, resolve the discrepancies and try again
- To update your local clone with the latest changes, do the following
- Go to the original repository here
- Click on clone or download and then 'copy to clipboard'
- Open git bash in the local repository folder and type the following
git remote add upstream
and hitShift + Ins
git fetch upstream
fetches all the branches of that remote into remote-tracking branchesgit checkout master
makes sure that you're on your master branchgit rebase upstream/master
rewrites your master branch so that any commits of yours that aren't already in upstream/master are replayed on top of that other branch
- To update your fork on GitHub, follow step 7
git push origin master
will do the trick most of the time