git pull origin master --allow-unrelated-histories
- In the folder, write in the terminal:
git init
- Untracked files are shown
git status
- Stage files to add
git add test.py
git add .
- Show status again
git status
- Create a new version. Each version has its own title.
m - message
git commit -m 'First version of the project!'
git commit -am "When something should be deleted use this!"
- Shows the latest commit
git log
to exit log: - q
- Not needed, a way to register:
git config --global user.name "Vitosh"
git config --global user.email "mail@mail.mail"
- Shows the different versions
git diff
- Create new repository at github:
https://github.com/new
- Remotes per repository
git remote -v
vman@vman-Studio-1555:~/Desktop/TestRepo$ git remote -v
origin https://github.com/Vitosh/TestRepo.git (fetch)
origin https://github.com/Vitosh/TestRepo.git (push)
- Add a remote repository
git remote add {Name} {Address}
git remote add origin https://github.com/Vitosh/TestRepo.git
- Push
git push -u origin master
- Delete remote directory:
git remote rm origin
- Adding the repo:
git remote add origin git@github.com:Vitosh/TestRepo.git
- Make SSH - Secure Shell
- Pulling
git pull origin master
- History Commits
- Cloning the repo
git clone git@github~
- Remove directory from git and local
git rm -r one-of-the-directories
git commit -m "Remove duplicated directory"
git push origin master
- Using branches
git branch rado
git checkout rado
- switched to branch rado
git checkout master
git push origin rado
git branch
- => returns a list of all branches
git merge rado
- history from rado goes to the master
git branch --delete rado
- (deletes) local master on the HD
git push origin --delete rado
- (deletes) master on the cloud
- generate collaborator:
touch B
echo "AA" >> B
cat B
AA
-
Fetch
git pull = git fetch + git merge -
Adding upstream
git remote add upstream https://~
-
git pull --rebase upstream master
-
if you **** ** and you need to reset git:
git reset --hard a0d3fe6
where a0d3fe6 is found by doing
git reflog
- Git overwrite local files with pull request
git fetch --all
git reset --hard origin/master
git pull origin master
git add .
git commit -m "some message here"
git status
git push origin master
- Rename the repository manually. Then run the command to see the new name.
git config --list
remote.origin.url=ssh://git@git.example.com/newNameHere.git
- Run Git to change the name
git remote set-url origin https://git.example.com/newNameHere.git
Navigate to the folder
- Windows:
del /F /S /Q /A .git
rmdir .git
- Linux:
rm -rf .git*
Get exact Git from the origin to overwrite the current changes:
git fetch --all
git reset --hard origin/master
https://stackoverflow.com/questions/1125968/how-do-i-force-git-pull-to-overwrite-local-files
git clean -n
git clean -f
git init
git remote add origin https://github.com/Vitosh/VBA_personal.git
git fetch --all
git checkout develop
