This page assumes you have a GitHub account.
Forking and cloning the Edgent source code repository
- Go to the incubator-edgent GitHub repository
Fork the repository by clicking on the Fork button at the top right. You’ll now have your own copy of that repository in your GitHub account (i.e., https://github.com/<YOUR_USERNAME>/incubator-edgent).
- Open a terminal/shell
Create a local clone of your fork
git clone git@github.com:<YOUR_USERNAME>/incubator-edgent
Go into the project directory
cd incubator-edgent
Add the remote repository
git remote add upstream https://github.com/apache/incubator-edgent.git
Verify the new upstream repository you've specified for your fork
$ git remote -v origin git@github.com:<YOUR_USERNAME>/incubator-edgent.git (fetch) origin git@github.com:<YOUR_USERNAME></incubator-edgent.git (push) upstream https://github.com/apache/incubator-edgent.git (fetch) upstream https://github.com/apache/incubator-edgent.git (push)
Pulling in remote changes
Update your master branch with remote master changes.
git co master git fetch upstream git merge upstream/master git push
Updating a pull request with the latest changes in the master branch
Before a pull request can be merged in, it must contain the latest changes.
git fetch upstream master git checkout master git rebase upstream/master # the clone's master is now up to date git push # the fork's master is now up to date git checkout EDGENT-XXX # EDGENT-XXX is the name of your branch; replace with your branch's name git rebase master # ... resolve any conflicts as noted by "git status" # the clone's EDGENT-XXX is now up to date git push -f # the fork's EDGENT-XXX is now up to date # if no other conflicting changes have happened on master, the PR should now report no conflicts
Setting up Git aliases
Set up your name and email address.
git config user.name "<FIRSTNAME LASTNAME>" git config user.email "<EMAIL>"
These are helpful for quick access to commonly used Git commands.
git config --global alias.co checkout # git checkout git config --global alias.br branch # git branch git config --global alias.ci commit # git commit git config --global alias.st status # git status git config --global alias.unstage 'reset HEAD --' # unstage changes git config --global alias.last 'log -1 HEAD' # see last commit git config --global alias.last5 'log -5 HEAD' # see last 5 commits git config --global alias.hist 'log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit --all' git config --global alias.ls 'log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate' # list commits in short form git config --global alias.ll 'log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat' # list commits showing changed files git config --global alias.ld 'log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative' # list oneline commits showing relative dates git config --global alias.f '!git ls-files | grep -i' # find a file path in codebase (usage: git f edgent) git config --global alias.grep 'grep = grep -Ii' # search/grep your entire codebase for a string git config --global alias.la '!git config -l | grep alias | cut -c 7-' # list all your aliases