-
Notifications
You must be signed in to change notification settings - Fork 0
Git
move back one directory
$ cd ..
check status
$ git status
to add updated files
$ git add <file_path>
to undo git add and remove file from staging
$ git reset <file_path>
to save changes and add a comment
$ git commit -m "<first commit>"
To show file the differences of files not yet staged
$ git diff
To show differences between staged files and the last file version
$ git diff --staged
to check the differences between branches
$ git diff <branch_name> <other_branch_name>
to see the history of activity/ git commands on that branch
$ history
to see the last 10 commands
$ history 10
Update master branch
$ git checkout master
$ git fetch origin -p
$ git reset --hard origin/master
$ git log
NOTE:
$ git fetch origin
can be executed on any branch
to create a new repo
$ git init <project_name>
to download an existing repo with it's version history
$ git clone <URL>
create new branch
$ git checkout -b <local_branch_name>
delete branch
$ git branch -d <local_branch_name>
display full list of git branches
$ git branch -a
to check current branch
$ git branch
Push local branch
$ git push origin <local_branch_name>
view the history
$ git log
Switch branches
$ git checkout <local_branch_name>
Remove file from staging
$ git rm <file_name>
$ git rm -r --cached node_modules/
Setting up Drupal environment in AWS
creating a new remote repository
create a new repo in the git UI, don't click add readme.md
In the terminal type mkdir <name> in the Sites directory ....
find …or push an existing repository from the command line in gitHub and paste the whole line into your directory
the run git push -u origin master
run
git remote rm origin
the run
git remote add myorigin git@github.com:myname/oldrep.git (find this on gitHub under …or create a new repository on the command line)
This command - I must read up on more !!
chmod 777 - this helped to resolve an error i had with not being able to pull file to master (i was 113 commits behind) this is the error msg error: Your local changes to the following files would be overwritten by merge: ``Please move or remove them before you merge