git init
git clone path/repo
git clone http://url/repo/projectname(.git)
git clone username@server:repo/projectname(.git)
git clone --single-branch --branch branchname host:/dir.git
git fetch --all
git reset --hard origin/develop
git pull origin develop
- Create a .gitignore file in the git repository if it does not contain one
touch .gitignore
- Open up the .gitignore and add the following line to the file node_modules/
- Remove the node_modules folder from the git repository
git rm -r --cached node_modules
- Commit the git repository without the node modules folder
git commit -m "Removed node_module folder"
- Push the repository to github
git push origin master
- After all of that, you should also add the gitignore and commit it to the repository
git add .gitignore
git commit -m "Updated the .gitignore file
git push origin master
git push <remote_name> --delete <branch_name>
git push <remote_name> :<branch_name>
git branch -d branch_name
git branch -D branch_name
as you can see above, we have 2 different argument, one with ‘d’ and one with ‘D’.
The -d option stands for --delete, which would delete the local branch, only if you have already pushed and merged it with your remote branches.
The -D option stands for --delete --force, which deletes the branch regardless of its push and merge status, so be careful using this one!
To stop tracking the files in the ignore file open a command prompt and navigate to the directory that contains your solution file (.sln) and run the following commands.
git rm -r --cached .
git add .
git commit -am "Remove ignored files"
That seemed to do the trick for me. The git commands I found here. If you click on that link you will see there are lots of options on which commands to use for this process. If the above doesn’t work for you one of the other answers should meet your needs.
In the future I will be making sure my ignore file exists first just to avoid any issues.
git pull -s recursive -X theirs remote-repo-url remote-branch --allow-unrelated-histories
Do you want to add git cheat in this file? What are you waiting for? Write a comment and add your cheat.