gitlab – Push to a repository using access_token

You should do git remote add origin https://<access-token-name>:<access-token>@gitlab.com/myuser/myrepo.git Note that this stores the access token as plain text in the .git\config file. To avoid this you can use the git credential system, providing the access token name for “username” and the access token for “password”. This should store the credentials in the git credential system … Read more

Push a commit in two branches with Git

Short answer You can apply already existing commit to another branch using cherry-pick command, and then push both branches using git push origin branchA branchB. Why pushing a commit in two branches might be useful Assume you have a repository with this structure: A–B–C–D ← master ← HEAD \–E ← v1-release After some development (commits … Read more

Time complexity of unshift() vs. push() in Javascript

push() is faster. js>function foo() {a=[]; start = new Date; for (var i=0;i<100000;i++) a.unshift(1); return((new Date)-start)} js>foo() 2190 js>function bar() {a=[]; start = new Date; for (var i=0;i<100000;i++) a.push(1); return((new Date)-start)} js>bar() 10 function foo() {a=[]; start = new Date; for (var i=0;i<100000;i++) a.unshift(1); return((new Date)-start)} console.log(foo()) function bar() {a=[]; start = new Date; for … Read more

Unable to Git-push master to Github – ‘origin’ does not appear to be a git repository / permission denied

What does $ git config –get-regexp ‘^(remote|branch)\.’ returns (executed within your git repository) ? Origin is just a default naming convention for referring to a remote Git repository. If it does not refer to GitHub (but rather a path to your teammate repository, path which may no longer be valid or available), just add another … Read more

How can I automatically deploy my app after a git push ( GitHub and node.js)?

Example in PHP: Navigate to github into your github repository add click “Admin” click tab ‘Service Hooks’ => ‘WebHook URLs’ and add http://your-domain-name/git_test.php then create git_test.php <?php try { $payload = json_decode($_REQUEST[‘payload’]); } catch(Exception $e) { exit(0); } //log the request file_put_contents(‘logs/github.txt’, print_r($payload, TRUE), FILE_APPEND); if ($payload->ref === ‘refs/heads/master’) { // path to your site … Read more

With Mercurial, how can I “compress” a series of changesets into one before pushing?

The histedit extension is exactly what you are looking for. hg histedit -o or hg histedit –outgoing will bring up a list of the outgoing changesets. From the list you can Fold 2 or more changesets creating one single changeset Drop changesets removing them from the history Reorder changesets however you like. histedit will prompt … Read more

Git: Pulling a rebased branch

If Mr. Orange doesn’t mind losing his changes, he can fetch from the server, then checkout the the branch: git checkout A to get onto his local A branch. Then, assuming the remote is named “origin”, reset your local branch in favor of the remote branch: git reset –hard origin/A If he is concerned with … Read more

git push: Push all commits except the last one

Try this (assuming you’re working with master branch and your remote is called origin): git push origin HEAD^:master HEAD^ points to the commit before the last one in the current branch (the last commit can be referred as HEAD) so this command pushes this commit (with all previous commits) to remote origin/master branch. In case … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)