Menu

GIT tips and tricks

Developers
Kevin Yeh
2012-11-09
2013-04-06
1 2 > >> (Page 1 of 2)
  • Kevin Yeh

    Kevin Yeh - 2012-11-09

    In response to Pimm's question about undoing commits in another thread I thought I'd start this one. Folks will hopefully discuss and share hints.

    Regarding "undoing" commits.

    git reset --hard HEAD~1
    

    This will rollback one commit on your local repository. 

    if you try

    git diff HEAD~1
    

    This will show you exactly what code you are going to revert if you issue the reset command.

     
  • Brady Miller

    Brady Miller - 2012-11-09

    Hi,

    Placed a link to this forum thread on the wiki page here: http://www.open-emr.org/wiki/index.php/Git_for_dummies#Tips_and_Tricks_and_Tools_that_are_useful

    The nice thing about git is that nothing is ever really lost after it is committed. For example, if you did above command and realized you wanted the commit back, you could do:

    git reflog
    

    Find the sha number (number on the left column) on the item below the top row (top row should have ' HEAD~1: updating HEAD'), and do:

    git reset --hard <sha number>
    

    -brady
    OpenEMR

     
  • Pieter W

    Pieter W - 2012-11-10

    I did four Commit in Github of these there are three not fit for implementation. It seems that one commit was implemented in the official Github Master.

    Question 1. Is my observation correct?

    Question 2. Who did approve this commit or did I make a mistake that seems to have done something that I should not have done?

    Question 3. Is a commit sufficient or should I send a note to somebody to approve or reject my Commit?

    Tnx for advise.

    Pimm

     
  • Kevin Yeh

    Kevin Yeh - 2012-11-10

    Q1. Where are you seeing that your one commit was pushed to master?

    Q2. The five integration developers, Brady, Rod, Stephen, Tony and Myself are the only ones who can push changes to master.  When a commit gets brought into the master branch, if it wasn't implemented originally by one of the integration developers, github reports "committed by <someone>" in the description after the "authored by <someoneelse>".
    As an example:
    https://github.com/openemr/openemr/commit/36e7915d6f05d98d7edf798d5f06f24947116d7f

    anilnakkani authored November 06, 2012 bradymiller committed November 06, 2012
    

    No code gets into the master branch without a "manual approval" step by an integration developer. 
    It is impossible to "do something that I should not have" that will impact the master branch by just issuing command to git/github.

    Q3. If you have a change in github you'd like to share. I think it's best to make an announcement here in the developer's forum with a link to the commit in github.  You can also post  in the tracker.  Just committing code to your own repository is not sufficient to get it into the master code base.

     
  • Pieter W

    Pieter W - 2012-11-13

    Please find a commit here:

    https://github.com/blankev/openemr-1/commit/9c224a89228d985f4fc63771f8d8a2543060cf35

    Really don't know if it is an addition, but at least I think that I might learn to understand GitHub a bit better.

    Question, if in the xlm(' name', 'e'), does the "e" stand  for English translation fields?

    Tnx for the support! Pimm

     
  • Pieter W

    Pieter W - 2012-11-13

    https://github.com/blankev/openemr-1/tree/master/library/classes

    this was committed to GitHub, but I don't know who accepted the code and who did help me to get it into the official OpenEMr 4.1.1. release…..

    Please give me some more insight of what happened?

    Tnx, Pimm

     
  • Brady Miller

    Brady Miller - 2012-11-13

    Hi Pimm,

    You committed it to your personal local and remote (on github) repos. Note your above link has blankev in the path, since you are using your repo. This is yours and nobody else can use it. Note the official OpenEMR repo is here:
    http://github.com/openemr/openemr
    (and only a few of us have access to modify this repo; it actually gets mirrored from the official OpenEMR repo on Sourceforge).

    -brady
    OpenEMR

     
  • Pieter W

    Pieter W - 2012-11-13

    Is my understanding correct?

    Delete my GitHub as is and open a new GitHub repository?

    Don't expect major changes, but you might expect some field and labels that are incorrectly used or labeled.

    Just experiencing and wnat to explore my knowledge from the book:

    PHP, MySQL and Apache

    I am using the Wondows option as promoted by GitHub. I still don't get the commands from Linux versions. I want to do too much and learn tooo little…. Stupid, btut that's the way I try to solve my OpenEMR problems.

    Tnx, Pimm

     
  • Brady Miller

    Brady Miller - 2012-11-13

    Hi Pimm,

    I wouldn't delete your repo, since you have work in there.

    Can you get to a command line at all from the windows version? I'm glad to supply the commands you'll need to straighten things out a bit. But need the content of your.git/config file (this can be found in the the openemr-1 directory.

    -brady
    OpenEMR

     
  • Pieter W

    Pieter W - 2012-11-13

    I changed a label in referral _template. html and the label template for the html fie.

    <span class='subhead'>{label_subhead_clinic}</span>
       </td>
       <td align='right' width='10%' valign='top' nowrap>
        <table border='1' cellpadding='2' cellspacing='0'>
         <tr>
          <td nowrap>{label_clinic_id}</td>
          <td style='width:60pt' nowrap>{fac_facility_npi}</td>
         </tr>
         <tr>
          <td nowrap>{label_pt_clinic_id}</td>

          <td nowrap>{ref_pid}</td>
         </tr>
         <tr>
          <td nowrap>{label_control_no}</td>

    Is this enough for reference in both files or do you need the complete files that both had only one line changed?

    Added {label_pt_clinic_id} in another file with the labels for the html file.

     
  • Tony McCormick

    Tony McCormick - 2012-11-13

    Windows versions have a feature called GitBash for command line operations.
    -Tony

     
  • Pieter W

    Pieter W - 2012-11-13

    I check off  GitBash in Github and there is a mark next to GitBash, but it is as if nothing changed.

    What is the next step?

     
  • Brady Miller

    Brady Miller - 2012-11-13

    Hi Pimm,

    Our time is better spent helping you use git/github to submit code (note that we can test/submit code that is in git within minutes whereas manual changes, as above, take much longer).

    -brady
    OpenEMR

     
  • Brady Miller

    Brady Miller - 2012-11-13

    Hi,
    From memory (I installed git/gitbash on windows a long time ago), I think you should have a gitbash shortcut on your desktop. If so, click it and then a command line should open up.
    -brady

     
  • Pieter W

    Pieter W - 2012-11-13

    Ok, so far so good, they named it: Git Shell and it gives a command line. Now what shall I do?

    Tell me if you can spend your time better, since I don't have a clue of what I am doing. I miss the User Interface…..

     
  • Pieter W

    Pieter W - 2012-11-13

    I found this somewhere in my local Github Directory:      -     .git   -  subdirectory

    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly

    fetch = +refs/heads/*:refs/remotes/origin/*
    url = https://github.com/xxxxxxxx/openemr-1.git

    remote = origin
    merge = refs/heads/master

    remote = origin
    merge = refs/heads/rel-411

     
  • Brady Miller

    Brady Miller - 2012-11-13

    Nice,

    Is there a string on the command line prompt (the string to the left of where you enter in text)? If so, what is it?

    Also, try to type:
    git status

    -brady

     
  • Kevin Yeh

    Kevin Yeh - 2012-11-13

    I would create a new empty directory at this point and change into it.  (Not sure if you have a bash shell or a regular command prompt at this point.)
    the do:

    git clone git@github.com:openemr/openemr
    cd openemr
    git branch referral_change
    git checkout referral_change
    

    At this point you have a fresh repository and a new branch to track the changes you want to make.  You should always make changes/updates in a branch that is separate from the master.
    If everything makes sense, seems to be working at this point, what you can do is copy the referral_template.html file from your other directory into this source file tree.
    At this point issue the command

    git diff
    

    It should show you what has changed from the original.
    If all this makes sense, then the next step would be to explain how to "publish" your changes so the rest of us can see.

     
  • Pieter W

    Pieter W - 2012-11-13

    Let us see if I did it correct:

    Show me how to publish!

    Pimm

     
  • Kevin Yeh

    Kevin Yeh - 2012-11-13

    If all of the commands I suggested worked, then try this

    git add .
    git commit -m "referral changes"
    git push git@github.com:blankev/openemr-1 referral_change
    
     
  • Pieter W

    Pieter W - 2012-11-13

    The string to the left is:

    github/openemr-openemr-281d34a\openemr

    git status

    # on branchreferral change
    nothing to commit(working directory clean)

     
  • Brady Miller

    Brady Miller - 2012-11-13

    Hi Pimm,
    You are already publishing to your github repo. I was in the middle of making the list of commands with explanations (that is the best way to learn) to get your repo up and working correctly and to publish. Are you still using the openemr-1 repo? Do not recommend changing it or making a new one since you've already got the repo publishing.
    -brady

     
  • Brady Miller

    Brady Miller - 2012-11-13

    Hi,
    Too many cooks in the kitchen. I'll back off and suggest you follow yehsters directions for now :)
    -brady

     
  • Pieter W

    Pieter W - 2012-11-13

    yester and brady,

    you got me on the road. I will make a note of all commands you sugested and if this did work, just the minor change, I might be able to reproduce all your advises in the futuere…. I still feel very basic….. other word for stupid.

    Tnx again, Pimm

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.