Home - ZaraTech/UrlShortener GitHub Wiki

Set up Git

The first step is setting up git. This is a git repository. First, you’ll need to sign up for an account on GitHub.com. Let's imagine that you account is named your-github-username.

Install git. Next, in your console type

$ git config --global user.name "Your real Here"
$ git config --global user.email "[email protected]"
$ git config --global push.default simple

Fork this repository

Forking this repository is very easy. First click on the 'Fork' button located at the right-top corner of the web UI. That's it!

Next you need to clone it locally. Run following commands in order to do so

$ git clone https://github.com/your-github-username/UrlShortener
$ cd UrlShortener
$ git remote add upstream https://github.com/ZaraTech/UrlShortener.git
$ git config user.email "[email protected]"

Keep synced this repository

Run the following commands to keep your repository synced

$ cd UrlShortener
$ git fetch upstream
$ git checkout master
$ git merge upstream/master

Upload changes

First add your changes into your local repository

$ cd UrlShortener
$ git add -A
$ git commit -m "with a concise description of the commit"

And then push them to your online repository in GitHub

$ git push

Reset Changes

First reset the branch's head

$ git reset --hard

And then remove any untracked files and directories

$ git clean -f -d

Ignore metadata

First add the name of the file or directory to the .gitignore file

[...]
ignored_file
ignored_dir/
[...]

Note the slash after the directory name

If you previously commited those files/directories, you must remove them from the git cache

$ git rm -r --cached ignored_file/dir