From Fedora Project Wiki

(interim save)
 
(another interim commit during talk)
Line 1: Line 1:
 
 
# Write some code
 
# Write some code
 
# Do <code>git-init</code>
 
# Do <code>git-init</code>
Line 12: Line 11:
 
#* Tells git to only stage files that have been modified or deleted, but ignores new files
 
#* Tells git to only stage files that have been modified or deleted, but ignores new files
 
# <code>git clone http://katzj.fedorapeople.org/git/fudcontest.git</code>
 
# <code>git clone http://katzj.fedorapeople.org/git/fudcontest.git</code>
 +
# <code>git commit --interactive</code>
 +
# On fedorapeople.org to get an executable: <code>ln -s /usr/bin/git-update-server-info git-update-server-info</code>
 +
# <code>git commit test => error: pathspec 'test' did not match any file(s) known to git.</code>
 +
#* == you forgot to add it
 +
#* <code>git status</code>
 +
#* <code>git add test</code>
 +
#* <code>git commit</code>
 +
# <code>git pull</code>
 +
#* '''Only if you have no changes locally'''
 +
#* Merges changes or forces you to fix (as you go)
 +
#* Shoves the trees together
 +
#* Best practice -- avoid running git pull on anything that is r/w
 +
#* Try a rebase:
 +
## <code>git rebase</code>
 +
## <code>gitk</code> -- GUI view of the repo
 +
## <code>git fetch</code>
 +
## <code>git commit --interactive</code> is useful
 +
# <code>git branch</code> -- ''use only to see what branches you have and what you are in''
 +
 +
=== Branching ===
 +
 +
# mkdir foo/ bar/
 +
# cd foo/
 +
# git (a branch) foo
 +
# git (a branch) bar
 +
 +
# mkdir livecd-tools.master
 +
# git clone ssh://git.fedorahosted.org/git/livecd.git livecd.f9
 +
# cd livecd.f9
 +
# git clone ssh://git.fedorahosted.org/git/livecd.git livecd.f9
 +
# git branchv
 +
# get checkout --track origin/f9-branch -b f9-branch
 +
 +
 +
== Tips ==
  
 +
* How git talks to itself is how it talks to you
 +
** Once you understand git talk, you understand git
 +
* Use fedorapeople.org ACLs to give commit permission
 +
** As a pre-fedorahosted.org step
 +
* The program <code>giggle</code> is a graphical viewer, but it's not maintained.
 +
* Use <code>git commit --interactive</code> to do a patch, if it is three lines away from other unchanged content
 +
* Use <code>git status</code> before you commit to be sure you are doing what you mean to do
 +
* <code>git checkout</code> == switch to a branch
 +
* ''master'' == HEAD (basically)
  
 
[[Category:FUDCon10]] [[Category:Draft Documentation]]
 
[[Category:FUDCon10]] [[Category:Draft Documentation]]

Revision as of 16:12, 21 June 2008

  1. Write some code
  2. Do git-init
  3. To commit, do git-commit
    • Do a short commit message (for first line browsers), then do more details below
      • The newline character is the marking point, the extra line space makes nice formatting
      • git shortlog
  4. git-config --global --list
    • git-config --global user.name "Foo Bar"
  5. git status
  6. git commit -a
    • Tells git to only stage files that have been modified or deleted, but ignores new files
  7. git clone http://katzj.fedorapeople.org/git/fudcontest.git
  8. git commit --interactive
  9. On fedorapeople.org to get an executable: ln -s /usr/bin/git-update-server-info git-update-server-info
  10. git commit test => error: pathspec 'test' did not match any file(s) known to git.
    • == you forgot to add it
    • git status
    • git add test
    • git commit
  11. git pull
    • Only if you have no changes locally
    • Merges changes or forces you to fix (as you go)
    • Shoves the trees together
    • Best practice -- avoid running git pull on anything that is r/w
    • Try a rebase:
    1. git rebase
    2. gitk -- GUI view of the repo
    3. git fetch
    4. git commit --interactive is useful
  12. git branch -- use only to see what branches you have and what you are in

Branching

  1. mkdir foo/ bar/
  2. cd foo/
  3. git (a branch) foo
  4. git (a branch) bar
  1. mkdir livecd-tools.master
  2. git clone ssh://git.fedorahosted.org/git/livecd.git livecd.f9
  3. cd livecd.f9
  4. git clone ssh://git.fedorahosted.org/git/livecd.git livecd.f9
  5. git branchv
  6. get checkout --track origin/f9-branch -b f9-branch


Tips

  • How git talks to itself is how it talks to you
    • Once you understand git talk, you understand git
  • Use fedorapeople.org ACLs to give commit permission
    • As a pre-fedorahosted.org step
  • The program giggle is a graphical viewer, but it's not maintained.
  • Use git commit --interactive to do a patch, if it is three lines away from other unchanged content
  • Use git status before you commit to be sure you are doing what you mean to do
  • git checkout == switch to a branch
  • master == HEAD (basically)