03:00
how should we do that?
03:00

beware
distributed version control system
git vs. github / gitlab / bitbucket
HEADterminal
shell
command-line interface (CLI)1
command subcommand --long-argument -s
pwd
cd
ls -lha
mkdir <directory-name>
rmdir <directory-name>
touch <file-name.ext>
cp <from-file> <to-file>
mv
rm -rf <directory>
03:00
hidden files:
git statusrun often
git statusgit stage$ git add index.qmd
warning: LF will be replaced by CRLF in index.qmd.
The file will have its original line endings in your working directorygit commit# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch main
#
# Initial commit
#
# Changes to be committed:
#       new file:   _quarto.yml
#       new file:   index.qmd
"~/Documents/projects/intro-git/.git/COMMIT_EDITMSG" 12L, 255BEDITORgit commit -mgit statuswith rstudio, vscode
git log❯ git log
commit 3efdc26af7bf6ea223bfa61c6cb4507de632690e (HEAD -> main)
Author: edavidaja <edavidaja@hey.com>
Date:   Thu Jul 20 15:03:03 2023 -0400
    added vs code workspace
commit 0d98a3c9cf2a351da39b26adbfad442c834ff8d4
Author: edavidaja <edavidaja@hey.com>
Date:   Thu Jul 20 14:55:34 2023 -0400
    added rstudio project files
commit cab0112f6f96bdd82a46e622d8fccd445fc38d17
Author: edavidaja <edavidaja@hey.com>
Date:   Thu Jul 20 14:51:23 2023 -0400
    initial commitgit statusgit push❯ git push -u origin main
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 12 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 418 bytes | 418.00 KiB/s, done.
Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/edavidaja/intro-git.git
 * [new branch]      main -> main
branch 'main' set up to track 'origin/main'.mkdir intro-git
cd intro-git
git init
touch _quarto.yml
git stage _quarto.yml
git commit -m "added quarto yml"
touch index.qmd
git stage index.qmd
git commit -m "added quarto document"create intro-git on GH
follow instructions to push
10:00
.gitignoreCTRL + ESCall equivalent:
git statusnew_branch10:00
git mergesecond_branch--set-upstream❯ git push
fatal: The current branch second-branch has no upstream branch.
To push the current branch and set the remote as upstream, use
    git push --set-upstream origin second-branch
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.git configgit config --global push.autoSetupRemote true
I set this globally because my workflow is pretty basic, ymmv
git push -u❯ git push -u origin second-branch
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 308 bytes | 308.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: Create a pull request for 'second-branch' on GitHub by visiting:
remote:      https://github.com/edavidaja/intro-git/pull/new/second-branch
remote:
To https://github.com/edavidaja/intro-git.git
 * [new branch]      second-branch -> second-branch
branch 'second-branch' set up to track 'origin/second-branch'.❯ git push
To https://github.com/edavidaja/intro-git.git
 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'https://github.com/edavidaja/intro-git.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.02:00
❯ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 636 bytes | 212.00 KiB/s, done.
From https://github.com/edavidaja/intro-git
   2bdda53..424444e  main       -> origin/main
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.❯ git pull --rebase
Auto-merging main.R
CONFLICT (content): Merge conflict in main.R
error: could not apply 160ea3e... added tidyverse
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 160ea3e... added tidyverse02:00
<<<<<<< HEAD
library(shiny)
||||||| parent of 160ea3e (added tidyverse)
=======
library(tidyverse)
>>>>>>> 160ea3e (added tidyverse)