what is the best way to connect local folder to existing github repo?
https://stackoverflow.com/questions/50025872/how-do-i-connect-a-local-folder-to-an-existing-github-repo
# Initialize the local directory as a Git repository.
git init
# Add files
git add .
# Commit your changes
git commit -m "First commit"
# Add remote origin
git remote add origin remote repository URL
# Remote URL look like this https://github.com/user/repo.git
# Verifies the new remote URL
git remote -v
# Push your changes
git push origin master
Create github repository
1. rm -rf .git
2. create a git repository on website.
3.
echo "# SydneyCameraRepair" >> README.md git init git add README.md git commit -m "first commit" git remote add origin git push -u origin master
To use Github destkop
Git commands
change branch (will show error if branch does not exist)git checkout CE-1234
current branch name
git branch | grep \*
Find all branch like CE-1234
git branch | grep CE-1234
check who is my origin
git remote -v
remote git commands?
Git remote …
https://help.github.com/en/github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line
who am I?
git config –list
history
git log
git log with file changes
git log --name-only
Revert to previous code
git log
git log –oneline
git checkout 27d2991486a742a16bc2d317b6d29d96a02b210c
git checkout -b CE-1234-kkk
//delete a remote commit
https://ncona.com/2011/07/how-to-delete-a-commit-in-git-local-and-remote/
git reset --hard 44780335d2c5790917e5908cbdd18b283b650e41
git push origin +CE-1234
quit?
q
//----------------------
Git Frequent
//----------------------
//rename local branch
git branch -m <new_name>
//delete local branch
git branch -d master//get remote master
git checkout --track origin/master
//create local branch
git branch CE-1234
git checkout CE-1234 or ...
git checkout -b CE-1234
//create local branch from the remote master branch
git checkout -b CE-1234 origin/master
//git push local
git commit -a -m "first commit"
//git push remote
git push -u origin CE-1234
git stash
git stash pop
git stash clear
//Discard all local changes to all files permanently:
git reset –hard
or
git stash
git reset vs revert
https://stackoverflow.com/questions/8358035/whats-the-difference-between-git-revert-checkout-and-reset
https://www.atlassian.com/git/tutorials/resetting-checking-out-and-reverting
https://stackoverflow.com/questions/22620393/various-ways-to-remove-local-git-changes
https://docs.gitlab.com/ee/topics/git/numerous_undo_possibilities_in_git/
git fetch
get pull
No comments:
Post a Comment