User Tools

Site Tools


git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
git [2022/04/08 08:23]
dblume Add instructions for rebasing
git [2022/04/25 11:43] (current)
dblume
Line 58: Line 58:
  
 <code> <code>
-git push -u origin master+git push -u origin main
 </code> </code>
  
Line 77: Line 77:
 git commit -m "first commit" git commit -m "first commit"
 git remote add origin https://github.com/dblume/hexbright-factory.git git remote add origin https://github.com/dblume/hexbright-factory.git
-git push -u origin master +git push -u origin main
-</code> +
- +
-===== Creating a new remote repository from an existing local one ===== +
- +
-I created wine-tasting at [[https://github.com/new]].  Then, to create a new repository on the command line at the local computer: +
- +
-<code> +
-~$ mkdir wine-tasting +
-~$ cd wine-tasting/ +
-wine-tasting$ vim README.md +
-wine-tasting$ vim LICENSE.txt +
-wine-tasting$ git init +
-wine-tasting$ git add README.md +
-wine-tasting$ git add LICENSE.txt +
-wine-tasting$ git add test.py +
-wine-tasting$ git add wine_allocator.py +
-wine-tasting$ git commit -m "first commit" +
-wine-tasting$ git remote add origin https://github.com/dblume/wine-tasting.git +
-wine-tasting$ git push -u origin master+
 </code> </code>
  
Line 156: Line 137:
 <code bash> <code bash>
 git checkout -b bugfix/JIRA-1-new-bugfix git checkout -b bugfix/JIRA-1-new-bugfix
-# If main is getting updated, occasionally rebase like so:+ 
 +# If main is getting updated, rebase like so:
 #   git checkout main #   git checkout main
 #   git pull #   git pull
 #   git checkout bugfix/JIRA-1-new-bugfix #   git checkout bugfix/JIRA-1-new-bugfix
 #   git rebase main #   git rebase main
 +
 +# Consider whether you want to squash commits before pushing
 +#   git reset --soft HEAD~3
 +
 git commit -m "fixed bug" git commit -m "fixed bug"
 git push --set-upstream origin bugfix/JIRA-1-new-bugfix git push --set-upstream origin bugfix/JIRA-1-new-bugfix
Line 190: Line 176:
 ... ...
 testcode$ git remote add origin ssh://USERNAME@dlma.com/~/git/testcode.git testcode$ git remote add origin ssh://USERNAME@dlma.com/~/git/testcode.git
-testcode$ git push origin master+testcode$ git push origin main
 </code> </code>
  
 I could've used gitweb but I used GitHub-like [[https://github.com/klaussilveira/gitlist|gitlist]] at http://git.dlma.com. I could've used gitweb but I used GitHub-like [[https://github.com/klaussilveira/gitlist|gitlist]] at http://git.dlma.com.
  
git.txt · Last modified: 2022/04/25 11:43 by dblume