Git create - delete - clear

Create, Commit, Push to remote:

 echo "# Device Configs Linh Trung" > README.md

git add .

git commit -m "Initial commit"

git push -u origin master


Delete multi file:

delete multi file: git rm $(git ls-files --deleted)


Clear version git:

git checkout --orphan temp_branch

git add -A

git commit -am "Purging Old History"

git branch -D master

git branch -m master

OR:

git pull --rebase

git reflog expire --expire=now --all

OR:

git fetch --prune

git prune

git gc


git push -f origin master


Đọc thêm..

Git Add Exam:

Git Add Exam: 

echo "# Device Configs Linh Trung" > README.md

git add .

git commit -m "Initial commit"

git push -u origin master


Create Git local:

git init
git add README.md
git add .
git commit -m "first commit"
git remote add origin https://github.com/userName/repoName.git
git push --force origin master
 
echo "# services" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/databom/services.git
git push -u origin main 
Đọc thêm..

How to solve this problem of "! [rejected] master -> master (fetch first)"

How to solve this problem of "! [rejected] master -> master (fetch first)"
First Do this ...
git fetch origin master
git merge master
Then, do this ...
git fetch origin master:tmp
git rebase tmp
git push origin HEAD:master
git branch -D tmp
Now everything works well.


OR:

git fetch origin master:tmp
git rebase tmp
git push origin HEAD:master
git branch -D tmp
Error: Message 'src refspec master does not match any' when pushing commits in Git
git init
git add .
git commit -m 'message'
git *create remote
git push -u origin master
OR
git checkout -b master
git add .
git commit -m "my commit message"
git push origin master
Đọc thêm..