Project:Sandbox

= Working With AirTies Software Build Profiles =

Introduction
Git is a distributed version control system.

'   The usual directory structure used for working with various Software Build Profiles is as follows:      ~/test/ /buildsys/ ... '   The exact name of the "test" and " " directories is up to you. However, the convention would be to use "test" and some subdirectory names that are meaningful to you. '   Some people choose to use names like:       "a", "b", "c", etc. ''' ''Or, a descriptive product name such as:       BGW210 or NVG599-2.4G_HEAD, etc.   ''Certainly, is is not a problem to use additional subdirectories as you wish, such as:       ~/test/NVG599/2.4G_HEAD/buildsys/, ~/test/NVG599/5G_HEAD/buildsys/, etc. 

Building an Image for a Specific Product
''Install Git      '$ sudo apt-get install git '  Customize your Git environment (If you have not already customize, you should never skip this step)      '$ git config --global user.name "Airties Anonymous Users"      $ git config --global user.email anonymous@airties.com '  Cloning can be accelerated by saving a copy of the repositories as a mirror in a folder on your computer. Make sure you have read and write permissions for the GIT_REFERENCE_REPOSITORIES directory      '$ git config --global references.path /opt/GIT_REFERENCE_REPOSITORIES '''

Git settings that must be made while using with Gerrit
Every change over gerrit must have a Jira Issue Number. For this reason, the commit log message has to be in the following format. Commit Message Summary Commit Message Body Issue:xxx You can edit your commit message template with the following commands so that your editor shows you a message page with an Issue: line in each git commit. '''echo -e "\n\nIssue:\n" >~/.git_log_template    git config --global commit.template ~/.git_log_template  In order for git changes to be sent to Gerrit, you must define the pub script as follow. echo -e '\n[alias]\n\tpub = "!f { git push -u ${1:-origin} --no-thin HEAD:`git config branch.$(git name-rev --name-only HEAD).merge | sed -e '"'"'s@refs/heads/@refs/for/@'"'"'`; }; f"\n\tdraft-pub = "!f { git push -u ${1:-origin} --no-thin HEAD:`git config branch.$(git name-rev --name-only HEAD).merge | sed -e '"'"'s@refs/heads/@refs/drafts/@'"'"'`;  }; f"\n\ttopic-pub = "!f { git push -u ${2:-origin} --no-thin HEAD:`git config branch.$(git name-rev --name-only HEAD).merge | sed -e '"'"'s@refs/heads/@refs/for/@'"'"' | sed '"'"'s@$@/'"'"'$1'"'"'@'"'"'`;  }; f"\n ' >> ~/.gitconfig git pub : ''' Once you’ve made your change and committed it locally to push it to Gerrit so that it can be reviewed. The git pub and git push origin HEAD:refs/for/master have the same meaning.

Access Repositories
Airties git repositories hosted on git.corp.airties.com can be accessed with two different protocols.

Git Protocol
You can clone the repositories using the GIT protocol with the following command. This protocol does not allow to commit the change. '''git clone git://git.corp.airties.com/ '''

SSH Protocol
Access to the repositories with this method is controlled by the Gerrit. You need to complete the following configuration for the SSH operations you will perform via 29418 port number. ''Log in to the Airties-Gerrit system using your Airties username and password.     Add your public key to Gerrit system. There is information on how to create the public key in the page you will access.     You can test the configuration with the following command. If the configuration is correct, you should see a welcome message titled "Welcome to Gerrit Code Review".        'ssh -p 29418 @git.corp.airties.com ''' You can clone the repositories using the SSH protocol with the following command. '''git clone ssh://@git.corp.airties.com:29418/ '''

Frequently used Git commands
checking status  ''Information about the status of your working copy     '$ git status  differences ''' ''You can see uncommitted changes in your working copy     '$ git diff '  Changes to the file     '$ git diff '  The names of the changed files     '$ git diff --name-only '  To compare two branch     '$ git diff master...development  adding files ''' ''To include in what will be committed     '$ git add '  Add changed and newly added files     '$ git add. '  Add changed and deleted files     '$ git add -u '  Add changed, newly added and deleted files     '$ git add -A  committing ''' ''Changes made to the working area are saved in the repository     '$ git commit '  Testing what to do with a committ     '$ git commit --dry-run '  Reconfigure the last commit operation.     '$ git commit --amend  tagging ''' ''To label any point on the repository     '$ git tag -a   updating ''' ''To take changes to the remote repository into the local repository     '$ git fetch '  To apply changes to the remote repository into the local repository     '$ git pull  resetting ''' ''To take back the committed change (Undo Add)     '$ git reset '  Undo commits permanently     '$ git reset --hard  branching ''' ''List of all branches     '$ git branch -a '  Create a branch     '$ git branch  '  Switch to another branch     '$ git checkout   logging ''' ''Show commit logs     '$ git log '  It can be seen in tree form with --graph.     '$ git log --graph '''