Github usage

hogeol·2022년 11월 4일
0

Github config

If you don't add '--global' option, the information of git is only applied to local repository

git config --global user.name "name"
git config --global user.email "e-mail address"

Set editor

If you set editor to GUI based editor, you can't using through remote work like 'SSH'

git config --global core.editor vim

Set Diff display tab size

Set tab size in Diff display to '2'

git config --global core.pager 'less -x2'

Set AutoCRLF

If work in different OS, the line ending is different

git config --global core.autocrlf "value"

Values
Windows: true (In commit, translate CRLF to LF + In Clone, translate LF to CRLF)
Linux: input (In commit, translate CRLF to LF)
Only windows: false (Any translation)
<WSL (Windows Subsystem for Linux): set to input>

CRLF?
CR(Carriage Return): move the cursor in front of the present line
LF(Line Feed): holding the paper up while keeping the cursor
Windows: default is CRLF
Linux(include OS X): default is LF

Checkout environment settings

git config --global --list

or

git config --global user.name

Remove github file in terminal

remove file in git repository

git rm ${filename}

or

git rm -rf ${filename} or ${folder name}

commit

git commit -m "remove ${filename}"

push

git push origin ${branch name}

GIT command

  • tig --all: shows project's outline/ tree view (shift X, to see version number)
  • q: quits tig --all menu
  • git fetch: fetch latest version on branch
  • git checkout : checkout to the branch you indicated (place yourself on top of branch)
  • git branch -d : delete branch locally
  • git checkout -b : create a branch (branch-name should follow this format: pi3/FRJ-2806)
  • git checkout : Discard changes in the working directory
    ctrl+r: search through your previous commands
  • git status: displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven’t, and which files aren’t being tracked by Git
  • git add -u: add all updated files from working directory to staging area
  • git commit -m "": records changes to the local repository
  • git push: updates remote repository
  • git push origin HEAD:: (format: pi3/FRJ-2806) pushes your local commits and places your local branch on a distant branch
  • git clean -f -d: removes untracked files (-f) and directories (-d) from working directory
  • git reset --hard: reverts the changes that you just made and goes back to the files that you had.
  • git reset : changes your local branch's head
  • history: shows the history of previous commands
  • make generate-: generates the project on TRESOS via command line make. Remeber to launch command when TRESOS is closed!
  • make build-: compiles generated files
  • make build- 2>>Log.txt: compiles generated files and stores terminal log on a txt file.
  • > toto.txt: places the result of a git command into toto.txt (">" crushes content, ">>" appends content), useful for logging builds.
  • git branch -m <new_name>: Renames local branch. You need to switch to the local branch before running this command.
  • git push origin -u <new_name>: Renames distant branch.
  • git push origin --delete <old_name>: Deletes old distant branch name.
    repo sync --force-sync: repo sync
  • git rebase -i HEAD~N: squashes all commits of a branch into one single commit (where N is the number of commits in the branch).
  • git reset --hard origin/: is the correct solution to reset all your local changes done by rebase.

0개의 댓글