Child pages
  • Using Git with Atlas
Skip to end of metadata
Go to start of metadata

Repository

 - Git repo URL:    https://git-wip-us.apache.org/repos/asf/atlas.git
 - Git repo mirror: https://github.com/apache/atlas
 - Releases:        https://dist.apache.org/repos/dist/release/atlas
 - Web site:        http:/atlas.apache.org

When attaching a patch to a JIRA , you may be tempted to create it by downloading from RBT, using the built in IDE Support, or using git patch; these approaches make more work for the committer. It is better to create the patch using the following procedure:   


        It will save reviewers and committers considerable time in dealing with 
        patch apply/revert, adding the commit message and author info etc. It also gives the correct credit to the author.
       
        Initial patch for a review:
        
          1. git add <files to be included in the patch>
        
          2. git commit -m “ATLAS-1234: Add more relationship instance validation”  (use your own JIRA number instead of 1234 , and your own short descriptive commit message)
        
          3. git format-patch origin/master
        
          4. Rename the file to: ATLAS-1234.patch
        
          5. Attach ATLAS-1234.patch to the JIRA

         

           6. Create a review in review board using the following procedure (this procedure ensures that the commit message and author from the am style patch is picked up by the RBT tool, so the download of the patch from RBT should contain this information):

    • Visit https://reviews.apache.org/
    • Click on ‘New Review Request
    • From the repository list shown at the left, select ‘atlas’
    • Click on ‘Select’ button and pick the “ATLAS-1234.patch” file you previously created.
    • Enter details of review, including: Summary, Description, Branch, Bugs, Groups, People
    • Click ‘Publish’

 

        Subsequent updates for the same review:
        
          1. git add <files to be updated in the patch>
        
          2. git commit -m “updated”
        
          3. merge this commit with earlier one:
        
             - git rebase -i
             NOTE - if you are working locally with multiple branches you need to specify the upstream to rebase with, for example
             - git-rebase -i master
        
             - a file should open up in your text editor. Change the first word in 
        the second line - from “pick” to “s”
        
             - another file should open up in your text editor. Remove the lines 
        for the second commit message.

       This is done so there is only one outstanding commit so when you run the format-patch only create 1 file is created. This step is effectively squashing the commits.
      Another way to do this is to use this command to undo the last commit, leaving the changes as staged.      
               - git reset HEAD~
      
          4. git format-patch origin/master
        
          5. rename the file to: ATLAS-1234-1.patch
        
          6. Attach ATLAS-1234.patch to the JIRA and create a review in review 
        board.


Some simple useful Git commands

To add all modfied java files
    - git add *.java      
To replace your working copy of a file with the master one (to undo your local changes for one file)      
    - git checkout origin/master -- <file>    
To git rid of everything locally and replace with the master
   - git fetch origin
   - git reset --hard origin/master
To list the commit ids
   - git log 
   - .q to end
To revert a commit
  - git revert <<commit number>>
This becomes more involved if the commit was part of a merge as there are more than one parent.

A Merge scenario. 
-You have a patch, but the master has moved on by one commit that conflicts with the patch -  so the patch will not apply 
Method
On master (only do this if you want to lose everything locally) 
 - git fetch origin
 - git reset --hard origin/master
Change to and create a new branch
 - git checkout -b ATLAS2029    
Back off the last commit
- git rebase -i HEAD~1 
Apply the patch
- git am < xxxx.patch
Switch to master
- git checkout master 
Merge
- git merge ATLA2029
Resolve conflicts
- git rebase --continue
If you have 2 commits do the git rebase -i to squash the merge commit

Git Prompt

A neat little project to provide a prettified & useful prompt that incorporates git status (MacOS)

 ~/src/atlas [ATLAS-1974-GovEngOMAS L|⚑ 3

https://github.com/magicmonty/bash-git-prompt/blob/master/README.md


 
       

 

  • No labels