Skip to content

Instantly share code, notes, and snippets.

@deidine
Last active July 15, 2024 08:21
Show Gist options
  • Save deidine/1aa0513d4934fa4d351434e886932b05 to your computer and use it in GitHub Desktop.
Save deidine/1aa0513d4934fa4d351434e886932b05 to your computer and use it in GitHub Desktop.
@config git
git config --global user.name "Firstname Lastname"
git config --global user.email "your.email@example.org"
@to push code to remote repositry
git init
git add .
git commit -m "Add foldername"
git branch -M main
git remote add origin https://github.com/deidine/project.git
git push -u origin main
or just
git add . && git commit -m "add stuff" && git push -u origin main
@to us rsa ssh connection to github
ssh-keygen -t ed25519 -C "deidine.cheigeur@vector-mind.com" #genrate paire key
eval "$(ssh-agent -s)" #to start agent
ssh-add deidine #add file privte key to agent
cat deidine.pub #paste public key in github
ssh -T git@github.com #verify connection to github
git remote set-url origin git@github.com:deidine/project.git #this to set url repo using ssh
@show thw remote repository url
git remote -v
@to fetch and clone the changes into local repo
git pull
git clone <the url of the repository>
@show branch name
#create new branch
$ git branch <name>
#list all branches
$ git branch -a -v
#Return all branches that has not merged
$ git branch --no-merged
#Return all branches thaat has merged
$ git branch --merged
#to merg branch with main branch but frist you should in main branch
$ git merge branch_name
# Switch to an existing branch:
$ git checkout <branch-name>
#Create and switch to a new branch
$ git checkout -b <branch-name>
# to delete brnach
$ git branch -d <name> or git branch -D deidine #this for froce delete
@show differnce and status and log and delete file
$ git show
$ git diff
$ git status
$ git log
$ git rm <filename>
$ git reset [commit id]
@Save all the modified tracked files temporarily:
$ git stash
$ git stash list
@for large file use
# Navigate to your repository
cd C:\Users\deidi\OneDrive\Bureau\projects\flutter\company\company
# Install Git LFS (if not already installed)
git lfs install
# Track .zip files with Git LFS
git lfs track "*.zip"
# Add the .gitattributes file and the large file
git add .gitattributes
git add prokit-flutter-2024.zip
# Commit your changes
git commit -m "Add large file with Git LFS"
# Push to GitHub
git push origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment